Пример #1
0
    def setUpClass(self):
        '''This is the 'setUpClass' method.

        Initializes the testing suite.
        '''
        app.config['TESTING'] = True
        self.app = app.test_client()
Пример #2
0
 def setUpClass(cls):
     """Initialize the test client with a sample database."""
     try:
         os.rename("file.json", "tmp")
     except IOError:
         pass
     cls.state = State(name="California")
     cls.state.save()
     cls.city = City(name="San Francisco", state_id=cls.state.id)
     cls.city.save()
     cls.amenity = Amenity(name="Internet")
     cls.amenity.save()
     cls.user = User(email="*****@*****.**", password="******")
     cls.user.save()
     cls.place = Place(name="School",
                       city_id=cls.city.id, user_id=cls.user.id)
     cls.amenity_2 = Amenity(name="bed")
     cls.amenity_2.save()
     if os.getenv("HBNB_TYPE_STORAGE") == "db":
         cls.place.amenities.append(cls.amenity_2)
     else:
         cls.place.amenity_ids.append(cls.amenity_2.id)
     cls.place.save()
     cls.review = Review(text="Stellar",
                         place_id=cls.place.id, user_id=cls.user.id)
     cls.review.save()
     cls.__app = app.test_client()
Пример #3
0
 def setUpClass(cls):
     """
     set the flask app in testing mode
     create a state, city, user, place to test place amenities
     """
     app.config['TESTING'] = True
     cls.app = app.test_client()
     cls.path = "/api/v1"
     cls.state_args = {"name": "Botswana", "id": "BO"}
     cls.state = State(**cls.state_args)
     cls.state.save()
     cls.city_args = {"name": "Gaborone", "id": "GA",
                      "state_id": cls.state.id}
     cls.city = City(**cls.city_args)
     cls.city.save()
     cls.user_args = {"email": "*****@*****.**", "password": "******",
                      "id": "U1"}
     cls.user = User(**cls.user_args)
     cls.user.save()
     cls.place_args = {"name": "cage", "city_id": cls.city.id,
                       "user_id": cls.user.id, "id": "CA"}
     cls.place = Place(**cls.place_args)
     cls.place.save()
     cls.amenity_args = {"name": "quokka"}
     cls.amenity = Amenity(**cls.amenity_args)
     cls.amenity.save()
     cls.place.amenities.append(cls.amenity)
     cls.place.save()
Пример #4
0
    def setUpClass(cls):
        '''This is the  'SetUpClass' method.

        Initialize testing suite.
        '''
        app.config['TESTING'] = True
        cls.app = app.test_client()
        cls.path = "/api/v1"
        cls.state_args = {"name": "TestState", "id": "TS"}
        cls.state = State(**cls.state_args)
        cls.state.save()

        cls.city_args = {
            "name": "TestCity",
            "id": "TC",
            "state_id": cls.state.id
        }
        cls.city = City(**cls.city_args)
        cls.city.save()

        cls.user_args = {
            "email": "*****@*****.**",
            "password": "******",
            "id": "T1"
        }
        cls.user = User(**cls.user_args)
        cls.user.save()
Пример #5
0
    def setUpClass(cls):
        '''This is the 'setUpClass' method.

        Set up for testing.
        '''
        app.config['TESTING'] = True
        cls.app = app.test_client()
        cls.path = "/api/v1"
Пример #6
0
 def setUpClass(cls):
     """set the flask app in testing mode - create a state to test cities"""
     app.config['TESTING'] = True
     cls.app = app.test_client()
     cls.path = "/api/v1"
     cls.state_args = {"name": "Botswana", "id": "BO"}
     cls.state = State(**cls.state_args)
     cls.state.save()
Пример #7
0
 def setUpClass(cls):
     """set the flask app in testing mode - create a state to test cities"""
     app.config['TESTING'] = True
     cls.app = app.test_client()
     cls.path = "/api/v1"
     cls.state_args = {"name": "Botswana", "id": "BO"}
     cls.state = State(**cls.state_args)
     cls.state.save()
Пример #8
0
    def setUpClass(cls):
        '''This is the 'setUpClass' method.

        Set up testing suite.
        '''
        app.config['TESTING'] = True
        cls.app = app.test_client()
        cls.path = "/api/v1"
        cls.state_args = {"name": "Test", "id": "TS"}
        cls.state = State(**cls.state_args)
        cls.state.save()
Пример #9
0
 def setUpClass(cls):
     """set the flask app in testing mode"""
     app.config['TESTING'] = True
     cls.app = app.test_client()
     cls.path = "/api/v1"
Пример #10
0
 def setUp(self):
     self.client = app.test_client()
Пример #11
0
 def setUp(self):
     '''
         Starts up flask for testing
     '''
     self.test_app = app.test_client()
Пример #12
0
 def setUpClass(self):
     app.config['TESTING'] = True
     self.app = app.test_client()
Пример #13
0
 def setUp(self):
     '''
         set-up for unit testing
     '''
     self.app = app.test_client()
Пример #14
0
 def setUp(self):
     app.config['TESTING'] = True
     app.config['WTF_CSRF_ENABLED'] = False
     app.config['DEBUG'] = False
     self.app = app.test_client()
Пример #15
0
 def setUpClass(cls):
     app.config['TESTING'] = True
     cls.app = app.test_client()
     cls.path = "/api/v1"
Пример #16
0
 def test_create_app(self):
     '''check app instance with blueprint is created'''
     with app.test_client() as c:
         self.assertIsInstance(c, flask.testing.FlaskClient)
Пример #17
0
 def setUpClass(self):
     """Create test client for all calls to api/app"""
     app.testing = True
     self.client = app.test_client()
     self.Amenity = classes["Amenity"]
Пример #18
0
 def setUpClass(cls):
     """set the flask app in testing mode"""
     app.config['TESTING'] = True
     cls.app = app.test_client()
     cls.path = "/api/v1"
 def setUpClass(cls):
     '''Set up flask'''
     from api.v1.app import app
     cls.app = app.test_client()
     '''
Пример #20
0
 def setUp(self):
     """
     Sets up the app for testing
     """
     self.test_app = app.test_client()
Пример #21
0
 def setUp(self):
     self.app = app.test_client(self)
     self.app.testing = True
Пример #22
0
 def test_create_app(self):
     """
     check app creation
     """
     with app.test_client() as c:
         self.assertIsInstance(c, flask.testing.FlaskClient)