Пример #1
0
    def setUp(self):
        serializer = AdminSerializer(data=self.test_user)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = TheaterAdminSerializer(data=self.test_theater_admin)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = AdminSerializer(data=self.test_fan_zone_admin)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = AdminSerializer(data=self.test_system_admin)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = AdminCategorySerializer(data=self.test_category_1)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = AdminCategorySerializer(data=self.test_category_2)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = MemberUsedPropSerializer(data=self.test_prop_1)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()
Пример #2
0
    def setUp(self):
        serializer = AdminSerializer(data=self.test_fan_zone_admin)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = TheaterAdminSerializer(data=self.test_theater_admin)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = AdminSerializer(data=self.test_system_admin)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()
Пример #3
0
    def setUp(self):
        serializer = TheaterAdminSerializer(data=self.test_theater_admin)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = AdminSerializer(data=self.test_fan_zone_admin)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = TheaterSerializer(data=self.test_theater)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = AdminCategorySerializer(data=self.test_category_1)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = AdminCategorySerializer(data=self.test_category_2)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = RestrictedOfficialPropSerializer(data=self.test_prop_1)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = RestrictedOfficialPropSerializer(data=self.test_prop_2)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()
Пример #4
0
def seed():
    for admin in system_admins:
        serializer = AdminSerializer(data=admin)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

    for admin in theater_admins:
        serializer = TheaterAdminSerializer(data=admin)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

    for admin in fan_zone_admins:
        serializer = AdminSerializer(data=admin)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

    for user in users:
        serializer = UserSerializer(data=user)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

    for theater in theaters:
        serializer = AdministrationSerializer(data=theater)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

    for auditorium in auditoriums:
        serializer = AuditoriumSerializer(data=auditorium)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

    for movie in movies:
        serializer = MovieSerializer(data=movie, partial=True)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

    for showtime in showtimes:
        serializer = ShowtimeSerializer(data=showtime, partial=True)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        saved = serializer.save()

        bookings = []
        seat_num = 1
        auditorium = Auditorium.objects.get(id=showtime['auditorium'])
        layout = auditorium.layout['layout']
        for row in layout:
            for seat in row:
                bookings.append(
                    Booking(showtime_id=saved.id, seat=seat_num, user_id=None))
                seat_num += 1
        Booking.objects.bulk_create(bookings)

    for category in categories:
        serializer = CategorySerializer(data=category, partial=True)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

    for prop in officialprops:
        serializer = OPropSerializer(data=prop, partial=True)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

    for prop in usedprops:
        serializer = UPropSerializer(data=prop, partial=True)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()
Пример #5
0
    def setUp(self):
        serializer = TheaterAdminSerializer(data=self.test_theater_admin)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = TheaterAdminSerializer(data=self.test_theater_admin2)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = AdminSerializer(data=self.test_fan_zone_admin)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = AdminSerializer(data=self.test_system_admin)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = AdminSerializer(data=self.test_user)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = AdministrationSerializer(data=self.test_theater)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = AdministrationSerializer(data=self.test_theater2)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = AuditoriumSerializer(data=self.auditorium)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = MovieSerializer(data=self.test_movie)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()

        serializer = ShowtimeSerializer(data=self.test_showtime)
        if not serializer.is_valid():
            raise Exception(serializer.errors)
        serializer.save()