55from app import app
66
77from .models import Photo
8+ from factory_responses import FactoryResponse
9+
810
911
1012class TestModelPhoto (BaseTestCase ):
1113 def test_new_photo (self ):
1214 photo = Photo ('1' ,'/test/photo.png' )
1315 self .assertTrue (photo .uuid ,'1' )
1416 self .assertTrue (photo .filepath ,'/test/photo.png' )
17+ class TestFactoryResponses (BaseTestCase ):
18+ responses = None
19+
20+ @classmethod
21+ def setUpClass (cls ):
22+ cls .responses = FactoryResponse ()
23+ @classmethod
24+ def tearDownClass (cls ):
25+ cls .responses = None
26+ def test_200_correct (self ):
27+ #TODO add respnse
28+ resp = self .responses .new200 ()
29+ self .assertTrue (resp .status_code == 200 )
30+ self .assertTrue (resp .content_type == "application/json" )
31+ def test_201_correct (self ):
32+ empty_data = {}
33+ resp = self .responses .new201 (empty_data )
34+ self .assertTrue (resp .status_code == 201 )
35+ self .assertTrue (resp .content_type == "application/json" )
36+ def test_202_correct (self ):
37+ resp = self .responses .new202 ()
38+ self .assertTrue (resp .status_code == 202 )
39+ self .assertTrue (resp .content_type == "application/json" )
1540
1641class TestPhotosViews (BaseTestCase ):
1742 def test_post_photo_correct (self ):
@@ -32,4 +57,4 @@ def post_photo_not_allowed_file(self):
3257 #self.app.logger.debug(response.json)
3358 #TODO add assert for correct response
3459 self .assertTrue (response .status_code == 202 )
35-
60+
0 commit comments