コード例 #1
0
    def test_update_rides__cancel(self, ride_factory: Factory,
                                  service: fixture) -> None:
        """As a Dispatcher, check to ensure that rides may be cancelled."""
        cancellation_reason: str = fake.sentence(nb_words=3)
        ride: dict = ride_factory.create(service=service)

        self.rides.visit()

        self.rides.cancel_ride(cancellation_reason, ride)

        row: RideRow = self.rides.single_rides_table.surface_ride_row(ride)
        assert row.ride_status == 'Canceled'
コード例 #2
0
ファイル: rides.py プロジェクト: jmt-transloc/ondemand-python
    class Params:
        """Optional params which change factory output when True.

        :param account_ride: Generate a ride using a rider with an existing account.
        :param future_ride: Generate a ride for a future date.
        :param same_day_future_ride: Generate a same day ride for a future time.
        :param hub_ride: Generate a ride which uses a hub address as pick up or drop off.

        :example usage: RideFactory.create(hub_ride=True)
        """

        account_ride: bool = Trait(rider=RiderFactory.build(
            account_rider=True))

        future_ride: bool = Trait(pickup={
            'address':
            '4506 Emperor Boulevard Durham, NC, USA',
            'position': {
                'latitude': 35.8724046,
                'longitude': -78.8426551
            },
            'priority':
            0,
            'timestamp':
            date_objects.build_date_string(days=1),
        }, )

        hub_ride: bool = Trait(pickup={
            'address': 'Stop #300 - TransLoc Office',
            'position': {
                'latitude': 35.8750625,
                'longitude': -78.8406699
            },
            'priority': 0,
        }, )

        ride_with_note: bool = Trait(note=fake.sentence(nb_words=3))

        same_day_future_ride: bool = Trait(pickup={
            'address':
            '4506 Emperor Boulevard Durham, NC, USA',
            'position': {
                'latitude': 35.8724046,
                'longitude': -78.8426551
            },
            'priority':
            0,
            'timestamp':
            date_objects.build_date_string(hours=1),
        }, )

        superuser_account_ride: bool = Trait(rider=RiderFactory.build(
            superuser_account_rider=True))
コード例 #3
0
    def test_edit_address(self, rider_address: fixture) -> None:
        """Yield an address from the API, edit a field, then check for a success state."""
        self.addresses.visit()

        before: str = self.addresses.addresses_list.surface_address_row(rider_address).data
        self.addresses.open_edit_address(address=rider_address)

        new_label = fake.sentence(nb_words=2)
        self.addresses.edit_address(new_label=new_label)

        after: str = self.addresses.addresses_list.surface_address_row(
            address_label=new_label, address=rider_address,
        ).data

        assert before != after
コード例 #4
0
    def test_cancel_ride__asap(self, ride_factory: Factory, service: fixture) -> None:
        """Cancel an existing 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.
        """
        cancellation_reason: str = fake.sentence(nb_words=3)
        ride: dict = ride_factory.create(service=service)

        self.dispatch.visit()

        self.dispatch.cancel_ride(cancel_reason=cancellation_reason, ride=ride)
        self.dispatch.ride_filters.select_filter('Complete')

        card: RideCard = self.dispatch.ride_card_panel.surface_ride_card(ride)
        assert card.ride_status == 'Canceled'
コード例 #5
0
    def test_cancel_ride(self, ride_factory: factory,
                         service: fixture) -> None:
        """Cancel an existing 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.
        """
        cancellation_reason: str = fake.sentence(nb_words=3)
        ride: dict = ride_factory.create(service=service)

        self.rides.visit()

        self.rides.cancel_ride(cancellation_reason, ride)

        row: RideRow = self.rides.single_rides_table.surface_ride_row(ride)
        assert row.ride_status == 'Canceled'
コード例 #6
0
    def test_edit_group(self, group: fixture) -> None:
        """Yield a group from the API, edit a field, then check for a success state."""
        self.groups.visit()

        before_name: str = self.groups.groups_list.surface_group_row(
            group).name
        self.groups.open_edit_group(group=group)

        new_name = fake.sentence(nb_words=2)
        self.groups.edit_group(new_name=new_name)

        after_name: str = self.groups.groups_list.surface_group_row(
            group,
            group_name=new_name,
        ).name

        assert before_name != after_name
コード例 #7
0
    def test_cancel_ride__upcoming(
        self, ride_factory: Factory, service_with_in_advance: fixture,
    ) -> None:
        """Cancel an upcoming ride, then check for a success state."""
        cancellation_reason: str = fake.sentence(nb_words=3)
        ride: dict = ride_factory.create(
            same_day_future_ride=True, service=service_with_in_advance,
        )

        self.dispatch.visit()

        self.dispatch.ride_filters.select_filter('Upcoming')
        self.dispatch.cancel_ride(cancel_reason=cancellation_reason, ride=ride)
        self.dispatch.ride_filters.select_filter('Complete')

        card: RideCard = self.dispatch.ride_card_panel.surface_ride_card(ride)
        assert card.ride_status == 'Canceled'