def remove_AcmeDb(self, num_of_cust): """ Drop all AcmeAir databases """ acmeair = AcmeAirUtils() if acmeair.is_acmeair_running() != 0: acmeair.stop_acmeair() cloudantUtils = CloudantDbUtils(test_properties) cloudantUtils.drop_all_databases()
def load_SpecCharValuePredicateData(self): """ Create booking data needed to test SpecCharValuePredicate """ try: acmeair = AcmeAirUtils() acmeair.start_acmeair() # book flights AA93 and AA330 flight1 = "AA93" flight2 = "AA330" # Step#1 - need to find the flights generated _id required for booking flight1_id = acmeair.get_flightId_by_number(flight1) print("{} id = {}".format(flight1, flight1_id)) flight2_id = acmeair.get_flightId_by_number(flight2) print("{} id = {}".format(flight2, flight2_id)) # Step#2 - add the boooking acmeair.book_flights("*****@*****.**", flight1, flight2) finally: acmeair.stop_acmeair()
def load_AcmeData(self, num_of_cust): """ Reset databases and use the AcmeAir database loader to populate initial customer, flight and airportmapping data. Does NOT generate user data like bookings. """ print("num_of_cust: ", num_of_cust) acmeair = AcmeAirUtils() try: if acmeair.is_acmeair_running() != 0: raise RuntimeError(""" AcmeAir is already running which may cause unexpected results when resetting databases. Please shut down the app and try again. """) else: cloudantUtils = CloudantDbUtils(test_properties) cloudantUtils.reset_databases() acmeair.start_acmeair() acmeair.load_data(num_of_cust) finally: acmeair.stop_acmeair()
def load_SpecCharValuePredicateData(self): """ Create booking data needed to test SpecCharValuePredicate """ try: acmeair = AcmeAirUtils() acmeair.start_acmeair() # book flights AA93 and AA330 flight1 = "AA93" flight2 = "AA330" # Step#1 - need to find the flights generated _id required for booking flight1_id = acmeair.get_flightId_by_number(flight1) print ("{} id = {}".format(flight1, flight1_id)) flight2_id = acmeair.get_flightId_by_number(flight2) print ("{} id = {}".format(flight2, flight2_id)) # Step#2 - add the boooking acmeair.book_flights("*****@*****.**", flight1, flight2) finally: acmeair.stop_acmeair()
def load_AcmeData(self, num_of_cust): """ Reset databases and use the AcmeAir database loader to populate initial customer, flight and airportmapping data. Does NOT generate user data like bookings. """ print ("num_of_cust: ", num_of_cust) acmeair = AcmeAirUtils() try: if acmeair.is_acmeair_running() != 0: raise RuntimeError(""" AcmeAir is already running which may cause unexpected results when resetting databases. Please shut down the app and try again. """) else: cloudantUtils = CloudantDbUtils(test_properties) cloudantUtils.reset_databases() acmeair.start_acmeair() acmeair.load_data(num_of_cust) finally: acmeair.stop_acmeair()