def test_get_table_restaurant_closed_failure(self): """ Try get a table utils without mocks """ app = create_app("FAILURE_TEST") # Test without mocks (FAILURE_TEST is configuration in config.ini that disable mocks but maintains fake data) app = app.app app.config['TESTING'] = True now = datetime.datetime.now() booking = now.replace( year=2020, month=11, day=17, hour=11, minute=30, second=0, microsecond=0) with app.app_context(): for i in [1,2,3,4]: r = get_a_table(i, 1, booking) self.assertEqual(r, None, msg=i) # expected None in case of connections problems
def test_get_restaurants_failure(self): """ Try get a restaurant's profile utils without mocks """ app = create_app("FAILURE_TEST") # Test without mocks (FAILURE_TEST is configuration in config.ini that disable mocks but maintains fake data) app = app.app app.config['TESTING'] = True with app.app_context(): r = get_restaurant(1) self.assertEqual(r, None, msg=r) # expected None in case of connections problems r = get_restaurant(0) self.assertEqual(r, None, msg=r) # expected None in case of connections problems r = get_restaurant(5) self.assertEqual(r, None, msg=r) # expected None in case of connections problems
def test_get_a_table_failure(self): """ Try get a table utils without mocks """ now = datetime.datetime.now() app = create_app("FAILURE_TEST") # Test without mocks (FAILURE_TEST is configuration in config.ini that disable mocks but maintains fake data) app = app.app app.config['TESTING'] = True with app.app_context(): booking = (now.replace(hour=13) + datetime.timedelta(days=1)) r = get_a_table(3, 1, booking) self.assertEqual(r, None, msg=r) # expected None in case of connections problems r = get_a_table(3, 4, booking) self.assertEqual(r, None, msg=r) # expected None in case of connections problems r = get_a_table(3, 5, booking) self.assertEqual(r, None, msg=r) # expected None in case of connections problems
def setUp(self): app = create_app("TEST") # Test with mocks self.app = app.app self.app.config['TESTING'] = True
def setUp(self): app = create_app( "FAILURE_TEST" ) # Test without mocks (FAILURE_TEST is configuration in config.ini that disable mocks but maintains fake data) self.app = app.app self.app.config['TESTING'] = True