def setUp(self): with mock.patch('snakebite.JWTAuthMiddleware', return_value=get_mock_auth_middleware()): self.api = get_test_snakebite().app self.resource = menu.Collection() self.api.add_route('/restaurants', self.resource) self.srmock = testing.StartResponseMock() self.restaurants = [ Restaurant(name='a', description='a', email='*****@*****.**', address='Roppongi Hills, Mori Tower, Minato-ku, Tokyo', geolocation=[139.729183, 35.660429]), # exactly at Roppongi Hills Mori Tower Restaurant(name='z', description='z', email='*****@*****.**', address='Nishi-Azabu, Minato-ku, Tokyo', geolocation=[139.727553, 35.659599]), # slightly away from Roppongi ] for r in self.restaurants: r.save() self.menus = [ Menu(name='curry chicken', price=550, currency='JPY', images=[], tags=['chicken', 'curry'], restaurant=self.restaurants[0]), Menu(name='keema curry', price=700, currency='JPY', images=[], tags=['indian', 'curry'], restaurant=self.restaurants[0]), Menu(name='tempura don', price=600, currency='JPY', images=[], tags=['japanese', 'fried'], restaurant=self.restaurants[1]), Menu(name='chahan set', price=900, currency='JPY', images=[], tags=['fried', 'rice'], restaurant=self.restaurants[1]), Menu(name='yakisoba', price=400, currency='JPY', images=[], tags=['noodles'], restaurant=self.restaurants[1]) ] for m in self.menus: m.save()
def setUp(self): with mock.patch('snakebite.JWTAuthMiddleware', return_value=get_mock_auth_middleware()): self.api = get_test_snakebite().app self.resource = restaurant.Item() self.api.add_route('/restaurants/{id}', self.resource) self.srmock = testing.StartResponseMock() restaurants = [ { 'name': 'a', 'description': 'desc A', 'email': '*****@*****.**', 'address': 'tokyo', }, { 'name': 'b', 'description': 'desc B', 'email': '*****@*****.**', 'address': 'kyoto', } ] self.restaurants = [] for r in restaurants: rest = Restaurant(**r) rest.save() self.restaurants.append(rest)
def setUp(self): with mock.patch('snakebite.JWTAuthMiddleware', return_value=get_mock_auth_middleware()): self.api = get_test_snakebite().app self.resource = batch.RestaurantCollection() self.api.add_route('/batch/restaurants', self.resource) self.srmock = testing.StartResponseMock() restaurants = [{ 'name': 'a', 'description': 'desc A', 'email': '*****@*****.**', 'address': 'tokyo', }, { 'name': 'b', 'description': 'desc B', 'email': '*****@*****.**', 'address': 'kyoto', }] self.restaurants = [] for r in restaurants: rest = Restaurant(**r) rest.save() self.restaurants.append(rest)
def setUp(self): with mock.patch('snakebite.JWTAuthMiddleware', return_value=get_mock_auth_middleware()): self.api = get_test_snakebite().app self.resource = restaurant.Collection() self.api.add_route('/restaurants', self.resource) self.srmock = testing.StartResponseMock()
def setUp(self): with mock.patch('snakebite.JWTAuthMiddleware', return_value=get_mock_auth_middleware()): self.api = get_test_snakebite().app self.resource = restaurant.Collection() self.api.add_route('/restaurants', self.resource) self.srmock = testing.StartResponseMock()
def setUp(self): with mock.patch('snakebite.JWTAuthMiddleware', return_value=get_mock_auth_middleware()): self.api = get_test_snakebite().app self.resource = rating.Item() self.api.add_route('/ratings/menus/{id}', self.resource) self.srmock = testing.StartResponseMock() self.setup_common_resources_DB()
def setUp(self): with mock.patch('snakebite.JWTAuthMiddleware', return_value=get_mock_auth_middleware()): self.api = get_test_snakebite().app self.resource = rating.Item() self.api.add_route('/ratings/menus/{id}', self.resource) self.srmock = testing.StartResponseMock() self.setup_common_resources_DB()
def setUp(self): with mock.patch('snakebite.JWTAuthMiddleware', return_value=get_mock_auth_middleware()): self.api = get_test_snakebite().app self.resource = menu.Collection() self.api.add_route('/restaurants', self.resource) self.srmock = testing.StartResponseMock() self.restaurant = Restaurant(name='a', description='a', email='*****@*****.**', address='Roppongi Hills, Mori Tower, Minato-ku, Tokyo', geolocation=[139.729183, 35.660429]) self.restaurant.save()
def setUp(self): with mock.patch('snakebite.JWTAuthMiddleware', return_value=get_mock_auth_middleware()): self.api = get_test_snakebite().app self.resource = menu.Item() self.api.add_route('/menus/{id}', self.resource) self.srmock = testing.StartResponseMock() self.menus = [ Menu(name='curry chicken', price=550, currency='JPY', images=[], tags=['chicken', 'curry']), Menu(name='keema curry', price=700, currency='JPY', images=[], tags=['indian', 'curry']) ] for m in self.menus: m.save()
def setUp(self): with mock.patch('snakebite.JWTAuthMiddleware', return_value=get_mock_auth_middleware()): self.api = get_test_snakebite().app self.resource = restaurant.Collection() self.api.add_route('/restaurants', self.resource) self.srmock = testing.StartResponseMock() self.restaurants = [ Restaurant(name='a', description='desc', email='*****@*****.**', address='Asakusa, Taito-ku, Tokyo', geolocation=[139.79843, 35.712074]), Restaurant(name='b', description='description', email='*****@*****.**', address='Roppongi, Minato-ku, Tokyo', geolocation=[139.731443, 35.662836]) ] for r in self.restaurants: r.save()
def setUp(self): with mock.patch('snakebite.JWTAuthMiddleware', return_value=get_mock_auth_middleware()): self.api = get_test_snakebite().app self.resource = restaurant.Item() self.api.add_route('/restaurants/{id}', self.resource) self.srmock = testing.StartResponseMock() self.restaurant = None rst = Restaurant(name='a', description='desc', email='*****@*****.**', address='Asakusa, Taito-ku, Tokyo', geolocation=[139.79843, 35.712074]) self.restaurant = rst.save()
def setUp(self): with mock.patch('snakebite.JWTAuthMiddleware', return_value=get_mock_auth_middleware()): self.api = get_test_snakebite().app self.resource = restaurant.Item() self.api.add_route('/restaurants/{id}', self.resource) self.srmock = testing.StartResponseMock() self.restaurant = None rst = Restaurant( name='a', description='desc', email='*****@*****.**', address='Asakusa, Taito-ku, Tokyo', geolocation=[139.79843, 35.712074] ) self.restaurant = rst.save()
def setUp(self): with mock.patch('snakebite.JWTAuthMiddleware', return_value=get_mock_auth_middleware()): self.api = get_test_snakebite().app self.resource = menu.Item() self.api.add_route('/menus/{id}', self.resource) self.srmock = testing.StartResponseMock() self.menu = None mnu = Menu( name='menu1', price=500, currency='JPY', tags=['chicken', 'curry'], images=[] ) self.menu = mnu.save()
def setUp(self): with mock.patch('snakebite.JWTAuthMiddleware', return_value=get_mock_auth_middleware()): self.api = get_test_snakebite().app self.resource = rating.Item() self.api.add_route('/ratings/menus/{id}', self.resource) self.srmock = testing.StartResponseMock() self.setup_common_resources_DB() self.ratings = [ MenuRating(user=self.users[0], menu=self.menus[0], rating=4.0), MenuRating(user=self.users[1], menu=self.menus[1], rating=2.0), MenuRating(user=self.users[0], menu=self.menus[1], rating=5.0) ] for r in self.ratings: r.save()
def setUp(self): with mock.patch('snakebite.JWTAuthMiddleware', return_value=get_mock_auth_middleware()): self.api = get_test_snakebite().app self.resource = rating.Collection() self.api.add_route('/rating/menus', self.resource) self.srmock = testing.StartResponseMock() self.setup_common_resources_DB() self.ratings = [ MenuRating(user=self.users[0], menu=self.menus[0], rating=4.0), MenuRating(user=self.users[1], menu=self.menus[1], rating=2.0), MenuRating(user=self.users[0], menu=self.menus[1], rating=5.0) ] for r in self.ratings: r.save()
def setUp(self): with mock.patch('snakebite.JWTAuthMiddleware', return_value=get_mock_auth_middleware()): self.api = get_test_snakebite().app self.resource = tag.Collection() self.api.add_route('/tags', self.resource) self.srmock = testing.StartResponseMock() self.tags = [ 'buzzword', 'hipster', 'trending', 'barely trending', 'classic', 'safe', 'weird', 'regrettable' ] for i in range(len(self.tags)): r = Menu(name='Menu #{}'.format(i), price=200.00, currency='JPY', images=['http://example.com/1.jpg'], tags=[]) r.tags = self.tags[:-i] if i else self.tags # first restaurant has more tags than the next r.save()
def setUp(self): with mock.patch('snakebite.JWTAuthMiddleware', return_value=get_mock_auth_middleware()): self.api = get_test_snakebite().app self.resource = restaurant.Collection() self.api.add_route('/restaurants', self.resource) self.srmock = testing.StartResponseMock() self.restaurants = [ Restaurant(name='a', description='desc', email='*****@*****.**', address='Asakusa, Taito-ku, Tokyo', geolocation=[139.79843, 35.712074]), Restaurant(name='b', description='description', email='*****@*****.**', address='Roppongi, Minato-ku, Tokyo', geolocation=[139.731443, 35.662836]) ] for r in self.restaurants: r.save()