def test_recommendation_output1(self):
     token = TestConstants.SEARCH_BY_REST_TOKEN
     decoded = decode(token, Constants.SECRET)
     customer_id = decoded['_id']
     restaurant_prefix = "Ram"
     orders = Orders.all(token)
     reviews= Reviews.by_customer_id(customer_id, token)
     restaurants = Restaurants.all(token)
     self.assertEqual("5ebcf11126e32517c46effff",
     final(reviews, restaurants, orders, customer_id, restaurant_prefix, token)[0]["id"])
Example #2
0
def main(customer_id, restaurant_prefix, token):

    try:
        restaurants_data = final(Reviews.by_customer_id(customer_id, token),
                                 Restaurants.all(token), Orders.all(token),
                                 customer_id, restaurant_prefix, token)
    except Exception as error:
        answer = dict({
            Constants.SUCCESS: "false",
            Constants.ERROR: error.__str__()
        })
        return answer

    answer = dict({
        Constants.SUCCESS: "true",
        Constants.DATA: restaurants_data
    })
    return answer