@@ -235,13 +235,16 @@ def test_create_successful(self):
235235 "project" : "my_project" ,
236236 },
237237 )
238- response_json = rv .get_json ()
239238
240- self .assertIn ( "id" , response_json )
241- # Remove the ID to compare against the standard successful response
242- del response_json [ "id" ]
239+ with self .wp10db . cursor () as cursor :
240+ cursor . execute ( "SELECT b_id FROM builders WHERE b_name = 'my_list'" )
241+ result = cursor . fetchone ()
243242
244- self .assertEqual (self .successful_response , response_json )
243+ db_id = result ["b_id" ].decode ("utf-8" )
244+
245+ expected = {"success" : True , "id" : db_id , "items" : {}}
246+
247+ self .assertEqual (expected , rv .get_json ())
245248
246249 def test_create_throws (self ):
247250 self .app = create_app ()
@@ -292,13 +295,18 @@ def test_update_successful(self):
292295 },
293296 )
294297
295- response_json = rv .get_json ()
298+ with self .wp10db .cursor () as cursor :
299+ cursor .execute (
300+ "SELECT b_name FROM builders WHERE b_id = %s" ,
301+ (builder_id .encode ("utf-8" ),),
302+ )
303+ result = cursor .fetchone ()
304+
305+ self .assertEqual (b"updated_list" , result ["b_name" ])
296306
297- self .assertIn ("id" , response_json )
298- # Remove the ID to compare against the standard successful response
299- del response_json ["id" ]
307+ expected = {"success" : True , "id" : builder_id , "items" : {}}
300308
301- self .assertEqual (self . successful_response , response_json )
309+ self .assertEqual (expected , rv . get_json () )
302310
303311 def test_update_not_owner (self ):
304312 builder_id = self ._insert_builder ()
0 commit comments