def setUpClass(cls):
     super(Test, cls).setUpClass()
     hotel = Hotel()
     hotel.name = 'Park Estique'
     hotel.country = 'India'
     hotel.city = 'Mumbai'
     hotel.street = 'Bajirao Road'
     hotel.description = 'This is a very good hotel'
     hotel.telephone_number = 12345
     hotel.star_ranking = 4.0
     hotel.number_of_rooms = 10
     insert_value(hotel)
Example #2
0
 def test_index_by_stars(self):
     self.assertEqual(len(DataStore().star_ranking_indexed_data), 0)
     hotel = Hotel()
     hotel.name = 'Park Estique'
     hotel.country = 'India'
     hotel.city = 'Mumbai'
     hotel.street = 'Bajirao Road'
     hotel.description = 'This is a very good hotel'
     hotel.telephone_number = 12345
     hotel.star_ranking = 4.0
     hotel.number_of_rooms = 10
     insert_value(hotel)
     index_by_city(hotel)
     self.assertEqual(len(DataStore().star_ranking_indexed_data), 1)
def add_hotel(request):
    '''
    
    :param request:
    '''
    return insert_value(build_hotel_object(request.body))
        self.boolean_search = BooleanSearch()

    def test_search_correct_result(self):
        self.assertEqual(
            len(self.boolean_search.search("hotel_name", "park AND estique")),
            1)

    def test_search_raises_exception(self):
        self.assertRaises(
            AttributeError,
            lambda: self.boolean_search.search("hotel_name", None))

    def test_search_no_result(self):
        self.assertNotEqual(
            len(self.boolean_search.search("hotel_name", "park AND estique")),
            0)


if __name__ == "__main__":
    #import sys;sys.argv = ['', 'Test.testName']
    hotel = Hotel()
    hotel.name = 'Park Estique'
    hotel.country = 'India'
    hotel.city = 'Mumbai'
    hotel.street = 'Bajirao Road'
    hotel.description = 'This is a very good hotel'
    hotel.telephone_number = 12345
    hotel.star_ranking = 4.0
    hotel.number_of_rooms = 10
    insert_value(hotel)
    unittest.main()