Esempio n. 1
0
    def test_accommodation_event_creation(self):
        """
        Testing the creation of accommodation event.
        """
        meeting = Container.events_service().create_general_event(
            title='Dummy flight',
            starting_date=datetime.now(),
            timeline=self.timeline,
        )

        self.assertEquals(
            self.user.timeline_set.first().generalevent_set.first(), meeting)
Esempio n. 2
0
    def test_lunch_event(self):
        """
        Testing the lunch event.
        """
        lunch = Container.events_service().create_lunch(
            title='Lunch',
            starting_date=datetime.now(),
            timeline=self.timeline,
            location=self.create_location())

        self.assertEquals(lunch,
                          self.user.timeline_set.first().lunch_set.first())
Esempio n. 3
0
    def test_create_flight(self):
        """
        Testing the creation of a flight.
        """
        flight = Container.events_service().create_flight_event(
            title='Dummy flight',
            starting_date=datetime.now(),
            timeline=self.timeline,
            origin='House of cats',
            destination='Another house of cats',
            extra_info='Keep calm',
            location=self.create_location())

        self.assertEquals(self.user.timeline_set.first().flight_set.first(),
                          flight)
Esempio n. 4
0
    def test_accommodation_event_creation(self):
        """
        Testing the creation of accommodation event.
        """
        accommodation = Container.events_service().create_accommodation(
            title='Dummy flight',
            starting_date=datetime.now(),
            timeline=self.timeline,
            hotel_name='Special Diabetes hotel',
            room='213',
        )

        self.assertEquals(
            self.user.timeline_set.first().accommodation_set.first(),
            accommodation)
    def test_picking_car_event(self):
        """
        Testing the car picking event.
        """
        picking_car = Container.events_service().create_picking_car(
            title='Dummy flight',
            starting_date=datetime.now(),
            timeline=self.timeline,
            agency="Hertz",
            type="BMW",
            license_number="OutOfTime",
            location=self.create_location())

        self.assertEquals(
            picking_car,
            self.user.timeline_set.first().pickingcar_set.first())
Esempio n. 6
0
    def test_service_container_init(self):
        """
        Testing the service container is initialize and we pulling services of
        other packages.
        """

        Container.reset_services()

        # Checking event service.
        self.assertEquals(Container.services['events_service'], Events.Service)
        self.assertEquals(Container.events_service().info(),
                          Events.Service().info())

        # Testing location service.
        self.assertEquals(Container.services['location_service'],
                          Location.Service)
Esempio n. 7
0
    def test_create_meeting_conjunction(self):
        """
        Testing the creation of a meeting conjunction.
        """
        create_meeting_conjunction_kwargs = {
            'members': (self.alice, self.bob),
            'title': 'Dummy flight',
            'starting_date': datetime.now(),
            'timeline': self.timeline,
            'location': self.create_location()
        }
        meeting_conjunction = Container.events_service()\
            .create_meeting_conjunction(**create_meeting_conjunction_kwargs)

        referenced_conjunctions = self.user.timeline_set.first()\
            .meetingconjunction_set.first()

        self.assertEquals(referenced_conjunctions, meeting_conjunction)
        self.assertTrue(self.alice in referenced_conjunctions.members.all())
        self.assertTrue(self.bob in referenced_conjunctions.members.all())
Esempio n. 8
0
    def prepare_trip(self, user):
        """"
        Preparing the trip for a given user: timeline, flight etc. etc.
        """

        timeline = self.create_timeline(user)

        picking_car = Container.events_service().create_picking_car(
            title=f'Dummy flight for user {user.username}',
            starting_date=datetime.now(),
            timeline=timeline,
            agency="Hertz",
            type="BMW",
            license_number="OutOfTime",
            location=self.location
        )

        connection_flight = Container.events_service().create_flight_event(
            title=f'Connection dummy flight {user.username}',
            starting_date=datetime.now(),
            origin='House of cats',
            destination='Another house of cats',
            extra_info='Keep calm',
            location=self.location
        )

        flight = Container.events_service().create_flight_event(
            title=f'Dummy flight {user.username}',
            starting_date=datetime.now(),
            timeline=timeline,
            origin='House of cats',
            destination='Another house of cats',
            extra_info='Keep calm',
            location=self.location,
            connection_flight=connection_flight
        )

        create_meeting_conjunction_kwargs = {
            'members': (self.alice, self.bob),
            'title': f'Dummy flight {user.username}',
            'starting_date': datetime.now(),
            'timeline': timeline,
            'location': self.location
        }
        meeting_conjunction = Container.events_service()\
            .create_meeting_conjunction(**create_meeting_conjunction_kwargs)

        accommodation = Container.events_service().create_accommodation(
            title=f'Dummy flight {user.username}',
            starting_date=datetime.now(),
            timeline=timeline,
            hotel_name='Special Diabetes hotel',
            room='213',
        )

        lunch = Container.events_service().create_lunch(
            title='Lunch',
            starting_date=datetime.now(),
            timeline=timeline,
            location=self.location
        )

        meeting = Container.events_service().create_meeting(
            title='Lunch',
            starting_date=datetime.now(),
            timeline=timeline,
            location=self.location
        )

        general_event = Container.events_service().create_general_event(
            title='Lunch',
            starting_date=datetime.now(),
            timeline=timeline,
            location=self.location
        )

        return {
            'timeline': timeline,
            'picking_car': picking_car,
            'flight': flight,
            'connection_flight': connection_flight,
            'meeting_conjunction': meeting_conjunction,
            'accommodation': accommodation,
            'lunch': lunch,
            'meeting': meeting,
            'general_event': general_event,
        }