@@ -75,21 +75,29 @@ def test_get(self):
75
75
self .assertEqual (response .code , 200 )
76
76
self .assertEqual (response .body , exp )
77
77
78
+ # test error
79
+ response = self .get ('/study/tags/bla' )
80
+ self .assertEqual (response .code , 400 )
81
+
78
82
def test_patch (self ):
79
83
arguments = {'op' : 'replace' , 'path' : '/tags' ,
80
84
'value[]' : "['testA', 'testB']" }
81
85
obs = self .patch ('/study/tags/1' , headers = self .header , data = arguments )
82
86
83
87
self .assertEqual (obs .code , 200 )
84
88
self .assertEqual (obs .body , '{"status": "success", "message": ""}' )
85
-
86
89
# checking the tags were added
87
90
response = self .get ('/study/tags/1' )
88
91
exp = ('{"status": "success", "message": "", "tags": '
89
92
'["[\' testA\' , \' testB\' ]"]}' )
90
93
self .assertEqual (response .code , 200 )
91
94
self .assertEqual (response .body , exp )
92
95
96
+ arguments = {'op' : 'replace' , 'path' : '/tags' ,
97
+ 'value[]' : "['testA', 'testB']" }
98
+ obs = self .patch ('/study/tags/b' , headers = self .header , data = arguments )
99
+ self .assertEqual (obs .code , 400 )
100
+
93
101
94
102
if __name__ == "__main__" :
95
103
main ()
0 commit comments