def test_booking__same_day__asap( self, recurring_ride_factory: Factory, service_with_recurring_rides: fixture, ) -> None: """Book a same day ASAP recurring ride, then check for a success state. This test is part of the smoke testing battery. Test failure should result in immediate remediation efforts as it is a main feature for the application. :param recurring_ride_factory: A factory for building recurring rides via the API or UI. :param service_with_recurring_rides: A recurring rides service yielded by the API. """ ride: dict = recurring_ride_factory.build() rider: dict = ride['ride']['rider'] rider_name = f'{rider["first_name"]} {rider["last_name"]}' self.dispatch.visit() self.dispatch.fill_ride_form( service=service_with_recurring_rides, ride=ride, ) self.dispatch.ride_booking_panel.schedule_form.select_ride_type( 'recurring') self.dispatch.fill_recurring_ride_form(ride) self.dispatch.ride_booking_panel.submit_ride_form() assert self.dispatch.ride_subscription_modal.ride_placard.rider_name == rider_name
def test_booking__limited_in_advance( self, recurring_ride_factory: Factory, service_with_limited_recurring_rides: fixture, ): """Book a recurring ride using a limited service, then check for an error state. This test is part of the smoke testing battery. Test failure should result in immediate remediation efforts as it is a main feature for the application. :param recurring_ride_factory: A factory for building recurring rides via the API or UI. :param service_with_limited_recurring_rides: A limited recurring rides service. """ ride: dict = recurring_ride_factory.build() self.dispatch.visit() self.dispatch.fill_ride_form( service=service_with_limited_recurring_rides, ride=ride, ) self.dispatch.ride_booking_panel.schedule_form.select_ride_type( 'recurring') self.dispatch.fill_recurring_ride_form(ride) self.dispatch.ride_booking_panel.submit_ride_form() errors = self.dispatch.ride_subscription_modal.subscription_errors assert errors.container.visible is True
def test_booking__future_day( self, ride_factory: Factory, service_with_in_advance: fixture, ) -> None: """Input valid ride information for a future next day ride, then check for a success state. This test is part of the smoke testing battery. Test failure should result in immediate remediation efforts as it is a main feature for the application. :param ride_factory: A factory for building rides via the API or UI. :param service_with_in_advance: An in-advance service yielded by the API. """ ride: dict = ride_factory.build(future_ride=True) rider: dict = ride['rider'] ride_pickup: str = ride['pickup']['timestamp'] rider_name = f'{rider["first_name"]} {rider["last_name"]}' ride_time: datetime = datetime.strptime(ride_pickup, '%Y-%m-%dT%H:%M:%S.%fZ') self.dispatch.visit() self.dispatch.fill_ride_form(service=service_with_in_advance, ride=ride) self.dispatch.ride_booking_panel.schedule_form.select_ride_type( 'future') self.dispatch.fill_future_ride_form(ride) self.dispatch.ride_booking_panel.submit_ride_form() self.rides.visit() self.rides.filters.filter_by_date(ride_time.strftime('%m-%d-%Y')) row: RideRow = self.rides.single_rides_table.surface_ride_row(ride) assert row.ride_name == rider_name
def test_booking__future_day( self, recurring_ride_factory: Factory, service_with_recurring_rides: fixture, ): """Book a future day recurring ride, then check for a success state. :param recurring_ride_factory: A factory for building recurring rides via the API or UI. :param service_with_recurring_rides: A recurring rides service yielded by the API. """ ride: dict = recurring_ride_factory.build(future_recurring_ride=True) ride_start: datetime = datetime.strptime( ride['ride']['pickup']['timestamp'], '%Y-%m-%dT%H:%M:%S.%fZ', ) ride_end: datetime = datetime.strptime( ride['rides'][-1]['timestamp'], '%Y-%m-%dT%H:%M:%S.%fZ', ) actual_start: str = ride_start.strftime('%b %d, %Y') actual_end: str = ride_end.strftime('%b %d, %Y') self.dispatch.visit() self.dispatch.fill_ride_form( service=service_with_recurring_rides, ride=ride, ) self.dispatch.ride_booking_panel.schedule_form.select_ride_type( 'recurring') self.dispatch.fill_recurring_ride_form(ride) self.dispatch.ride_booking_panel.submit_ride_form() assert actual_start and actual_end in self.dispatch.ride_subscription_modal.message
def test_booking__same_day__future_time( self, ride_factory: Factory, service_with_in_advance: fixture, ) -> None: """Input valid ride information for a future same day ride, then check for success. This test is part of the smoke testing battery. Test failure should result in immediate remediation efforts as it is a main feature for the application. :param ride_factory: A factory for building rides via the API or UI. :param service_with_in_advance: An in-advance service yielded by the API. """ ride: dict = ride_factory.build(same_day_future_ride=True) rider: dict = ride['rider'] rider_name = f'{rider["first_name"]} {rider["last_name"]}' self.dispatch.visit() self.dispatch.fill_ride_form(service=service_with_in_advance, ride=ride) self.dispatch.ride_booking_panel.schedule_form.select_ride_type( 'future') self.dispatch.fill_future_ride_form(ride) self.dispatch.ride_booking_panel.submit_ride_form() self.dispatch.ride_filters.select_filter('Upcoming') card: RideCard = self.dispatch.ride_card_panel.surface_ride_card(ride) assert card.rider_name == rider_name
def test_booking__with_note( self, ride_factory: Factory, service_with_in_advance: fixture, ) -> None: """Create a valid future ride with driver note, then check for the note after creation. :param ride_factory: A factory for building rides via the API or UI. :param service_with_in_advance: An in-advance service yielded by the API. """ ride: dict = ride_factory.build(same_day_future_ride=True, ride_with_note=True) note: str = ride['note'] self.dispatch.visit() self.dispatch.fill_ride_form(service=service_with_in_advance, ride=ride) self.dispatch.ride_booking_panel.schedule_form.select_ride_type( 'future') self.dispatch.fill_future_ride_form(ride) self.dispatch.ride_booking_panel.submit_ride_form() self.dispatch.ride_filters.select_filter('Upcoming') card: RideCard = self.dispatch.ride_card_panel.surface_ride_card(ride) assert card.note == f'Driver Note: {note}'
def exec_game(game_type, env): """ Function which runs a game according to the current configuration """ local_search_type = env["local_search_type"] mode = env["mode"] time_limit = env["time_limit"] verbosity = env["verbosity"] game = Factory.build(game_type, local_search_type) game.max_time = time_limit game.verbose = (verbosity == "on") game.generate(mode) game.run() running_time = (time()-game.date_begin) * 1000 evaluation = game.evaluate(game.state_manager.state) msg = "" if game.outofsteps(): msg = "out of steps" elif game.outoftime(): msg = "out of time" else: msg = "perfect game" ui.show_end_game( game_type, evaluation, game.number_steps, running_time, msg)
def test_booking__with_note( self, recurring_ride_factory: Factory, service_with_recurring_rides: fixture, ): """Book a same day ASAP recurring ride with a note, then check for a success state. :param recurring_ride_factory: A factory for building recurring rides via the API or UI. :param service_with_recurring_rides: A recurring rides service yielded by the API. """ ride: dict = recurring_ride_factory.build(ride_with_note=True) note: str = ride['ride']['note'] self.dispatch.visit() self.dispatch.fill_ride_form( service=service_with_recurring_rides, ride=ride, ) self.dispatch.ride_booking_panel.schedule_form.select_ride_type( 'recurring') self.dispatch.fill_recurring_ride_form(ride) self.dispatch.ride_booking_panel.submit_ride_form() assert (self.dispatch.ride_subscription_modal.ride_placard.driver_note == f'Driver Note: {note}')
def test_hubs_must_be_used__failure( self, ride_factory: Factory, service_with_hub_address: fixture, ) -> None: """Build a ride using a non-hub address as PU/DO, then check for a failure state.""" ride = ride_factory.build(hub_ride=False) self.dispatch.visit() self.dispatch.fill_ride_form(service_with_hub_address, ride=ride) self.dispatch.ride_booking_panel.submit_ride_form() assert self.dispatch.ride_booking_panel.ride_form.service_error_check( ) is True
def test_add_vehicle(self, vehicle_factory: Factory, vehicle_type: fixture) -> None: """Input valid vehicle data, then check for a success state. This test is part of the smoke testing battery. Test failure should result in immediate remediation efforts as it is a main feature for the application. """ vehicle: dict if vehicle_type == 'accessible': vehicle = vehicle_factory.build(wheelchair_vehicle=True) else: vehicle = vehicle_factory.build() self.vehicles.visit() self.vehicles.add_new_vehicle(vehicle) row = self.vehicles.vehicles_list.surface_vehicle_row(vehicle) assert vehicle['call_name'] in row.vehicle_call_name vehicle['vehicle_id'] = row.vehicle_id self.API.delete_vehicle(vehicle)
def test_booked_rides__access(self, ride_factory: Factory, service: fixture) -> None: """As an Agent, ensure that I may view the Details page for a ride that I have booked. :param ride_factory: A factory for building rides via the API or UI. :param service: A service yielded by the API. """ agent_ride: dict = ride_factory.build() self.rides.visit() self.rides.navigate_to_legacy_ride_booking() self.legacy_rides.fill_ride_form(service, ride=agent_ride) self.legacy_rides.submit_ride_form() assert bool(self.details.loaded) is True
def test_hubs_must_be_used__success( self, ride_factory: Factory, service_with_hub_address: fixture, ) -> None: """Build a ride using a hub address as PU/DO, then check for a success state.""" ride = ride_factory.build(hub_ride=True) rider: dict = ride['rider'] rider_name: str = f'{rider["first_name"]} {rider["last_name"]}' self.dispatch.visit() self.dispatch.fill_ride_form(service_with_hub_address, ride=ride) self.dispatch.ride_booking_panel.submit_ride_form() card = self.dispatch.ride_card_panel.surface_ride_card(ride) assert card.rider_name == rider_name
def test_future_rides_require_enabled_service( self, ride_factory: Factory, service: fixture, ) -> None: """Attempt to book with an non-future rides service, then check for an error state. :param ride_factory: A factory for building rides via the API or UI. :param service: An non-in-advance service yielded by the API. """ ride: dict = ride_factory.build() self.dispatch.visit() self.dispatch.fill_ride_form(service, ride=ride) assert self.dispatch.ride_booking_panel.schedule_form.loaded is False
def test_booking__with_note(self, ride_factory: Factory, service: fixture) -> None: """Create a valid ride with driver note, then check for the note after creation. :param ride_factory: A factory for building rides via the API or UI. :param service: A service yielded by the API. """ ride: dict = ride_factory.build(ride_with_note=True) note: str = ride['note'] self.dispatch.visit() self.dispatch.fill_ride_form(service, ride=ride) self.dispatch.ride_booking_panel.submit_ride_form() card: RideCard = self.dispatch.ride_card_panel.surface_ride_card(ride) assert card.note == f'Driver Note: {note}'
def unmarshal(self, unmarshaller): self.clear() keys = unmarshaller.readKeysOrNone() assert keys != None, 'no keys found in Metric' for key in keys: object_type = unmarshaller.readObjType(key) if object_type == "simple": self.setValue(key, unmarshaller.readObj(key)) else: from factory import Factory object = Factory.build(object_type) if isinstance(object, list): unmarshaller.readSequence(key, object) else: unmarshaller.readMap(key, object) self.setValue(key, object)
def test_booking(self, ride_factory: Factory, service: fixture) -> None: """Input valid ride information for an asap ride, then check for a success state. This test is part of the smoke testing battery. Test failure should result in immediate remediation efforts as it is a main feature for the application. :param ride_factory: A factory for building rides via the API or UI. :param service: A service yielded by the API. """ ride: dict = ride_factory.build() rider: dict = ride['rider'] rider_name = f'{rider["first_name"]} {rider["last_name"]}' self.dispatch.visit() self.dispatch.fill_ride_form(service, ride=ride) self.dispatch.ride_booking_panel.submit_ride_form() card = self.dispatch.ride_card_panel.surface_ride_card(ride) assert card.rider_name == rider_name
def test_submission_modal_features_rides_link( self, recurring_ride_factory: Factory, service_with_recurring_rides: fixture, ): """Book a recurring ride, then check for a rides link in the submission modal. :param recurring_ride_factory: A factory for building recurring rides via the API or UI. :param service_with_recurring_rides: A recurring rides service yielded by the API. """ ride: dict = recurring_ride_factory.build() self.dispatch.visit() self.dispatch.fill_ride_form( service=service_with_recurring_rides, ride=ride, ) self.dispatch.ride_booking_panel.schedule_form.select_ride_type( 'recurring') self.dispatch.fill_recurring_ride_form(ride) self.dispatch.ride_booking_panel.submit_ride_form() assert self.dispatch.ride_subscription_modal.rides_page_link.visible is True
response = requests.get(url, headers=headers) if response.status_code == 200: print(url) print(response) sp = BeautifulSoup(response.text, "html.parser") all_td = sp.find('td', {"class": "content"}).find_all('td') for td in all_td: #print("enter the Beautiful soup module") s = td.get_text() if s.strip() == "hive.query.string": print("entered hive.query.string") user_query = td.findNextSibling().get_text() user_query = str(user_query) #print(user_query) #else: # print("no hive MR job") return user_query #********************************************************************************************************************** if __name__ == '__main__': pd.set_option('display.width', 1000) pd.set_option('max_columns', 10) config = Setting() f = Factory() loader = f.build('server') res_mgr_df_processed = process_resource_manager_api(config, loader) setup_tunnel_server(config, res_mgr_df_processed)