def test_default_start_end_date(self): """ Verify Start/End Date """ try: s: str = b.default_start_date() e: str = b.default_end_date() # Assertions assert b.valid_date(s) assert b.valid_date(e) except Exception as err: raise ValueError(err)
def test_prep_data(self): """ Test Process Hotels Method """ try: session = requests.Session() out = b.prep_data(rooms, country, 'json', b.default_start_date(), b.default_end_date()) assert isinstance(out, list) assert len(out) > 0 except Exception as err: raise Exception(err)
def test_get_default_json(self): """ Verify json output """ try: b.get_data( rooms, country, out_format="json", start_date=b.default_start_date(), end_date=b.default_end_date(), ) assert os.path.isfile("hotels-in-{}.txt".format(country)) except IOError: print("Failure: File cannot be read.")
import unittest import booking as b import os import requests import csv offset = 15 rooms = 1 country = "Macedonia" start_date = b.default_start_date() end_date = b.default_end_date() class BookingTests(unittest.TestCase): @classmethod def test_get_booking_page(self): """ Verify get_booking_page """ session = requests.Session() i = b.get_booking_page(session, offset, rooms, country, start_date, end_date) assert i @classmethod def test_prep_data(self): """ Verify prep_data """ i: list = b.prep_data(rooms, country, start_date, end_date) assert i @classmethod def test_get_countries(self): """ Get Countries """