def setUpClass(self): '''This is the 'setUpClass' method. Initializes the testing suite. ''' app.config['TESTING'] = True self.app = app.test_client()
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()
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()
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()
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"
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()
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()
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()
def setUpClass(cls): """set the flask app in testing mode""" app.config['TESTING'] = True cls.app = app.test_client() cls.path = "/api/v1"
def setUp(self): self.client = app.test_client()
def setUp(self): ''' Starts up flask for testing ''' self.test_app = app.test_client()
def setUpClass(self): app.config['TESTING'] = True self.app = app.test_client()
def setUp(self): ''' set-up for unit testing ''' self.app = app.test_client()
def setUp(self): app.config['TESTING'] = True app.config['WTF_CSRF_ENABLED'] = False app.config['DEBUG'] = False self.app = app.test_client()
def setUpClass(cls): app.config['TESTING'] = True cls.app = app.test_client() cls.path = "/api/v1"
def test_create_app(self): '''check app instance with blueprint is created''' with app.test_client() as c: self.assertIsInstance(c, flask.testing.FlaskClient)
def setUpClass(self): """Create test client for all calls to api/app""" app.testing = True self.client = app.test_client() self.Amenity = classes["Amenity"]
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() '''
def setUp(self): """ Sets up the app for testing """ self.test_app = app.test_client()
def setUp(self): self.app = app.test_client(self) self.app.testing = True
def test_create_app(self): """ check app creation """ with app.test_client() as c: self.assertIsInstance(c, flask.testing.FlaskClient)