Exemplo n.º 1
0
    def setUp(self):
        # Non-featured organizers
        self.non_featured = OrganizerFactory.create_batch(2)

        # Featured organizers
        self.featured = OrganizerFactory.create_batch(2, feature=True)

        # URL
        self.url = reverse('organizers:featured')
Exemplo n.º 2
0
    def test_create(self):
        """
        Test the creation of the instance with the serializer
        """
        organizer = OrganizerFactory()

        data = {
            'sub_category': SubCategoryFactory().id,
            'organizer': organizer.id,
            'title': 'Clase de conducción',
            'short_description': 'Clase de conducción',
            'level': 'P',
            'goals': 'Conducir',
            'methodology': 'Por la derecha',
            'content': 'Poco la verdad',
            'audience': 'Ciegos y ancianos',
            'requirements': 'No saber conducir',
            'return_policy': 'Ninguna',
            'location': LocationFactory().id,
        }

        request = mock.MagicMock()
        request.user = organizer.user

        activities_counter = Activity.objects.count()
        serializer = ActivitiesSerializer(data=data, context={'request': request})
        serializer.is_valid(raise_exception=True)
        serializer.save()

        self.assertEqual(Activity.objects.count(), activities_counter + 1)
Exemplo n.º 3
0
    def test_validate_if_email_exists(self):
        """
        Validate if an organizer has that email
        If it has then raise a ValidationError
        """

        OrganizerFactory(user__email='*****@*****.**')
        response = self.client.post(self.create_url, self.data)
        self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
Exemplo n.º 4
0
    def setUp(self):
        # Users
        self.password = '******'
        self.student = StudentFactory(user__password=self.password)
        self.organizer = OrganizerFactory(user__password=self.password)

        # Tokens
        self.student_token = Token.objects.create(user=self.student.user)
        self.organizer_token = Token.objects.create(user=self.organizer.user)

        # URL
        self.url = reverse('auth:login')
Exemplo n.º 5
0
 def setUp(self):
     self.organizer = OrganizerFactory()
     self.student = StudentFactory()
     self.calendar = CalendarFactory(activity__organizer=self.organizer)
     self.organizer_message = OrganizerMessageFactory(
         calendar=self.calendar)
     self.assistants = AssistantFactory.create_batch(
         size=3,
         order__calendar=self.calendar,
         order__student=self.student,
         order__status=Order.ORDER_APPROVED_STATUS,
         enrolled=True)
Exemplo n.º 6
0
    def setUp(self):
        # Users
        self.student, self.another_student = StudentFactory.create_batch(2)
        self.organizer, self.another_organizer = OrganizerFactory.create_batch(
            2)

        # API Clients
        self.student_client = self.get_client(user=self.student.user)
        self.organizer_client = self.get_client(user=self.organizer.user)
        self.another_student_client = self.get_client(
            user=self.another_student.user)
        self.another_organizer_client = self.get_client(
            user=self.another_organizer.user)
Exemplo n.º 7
0
    def setUp(self):
        self.organizer = OrganizerFactory()
        self.calendar = CalendarFactory(activity__organizer=self.organizer)
        self.organizer_message = OrganizerMessageFactory(
            calendar=self.calendar)
        self.orders = OrderFactory.create_batch(
            size=3, calendar=self.calendar, status=Order.ORDER_APPROVED_STATUS)

        self.assistants = []
        for order in self.orders:
            self.assistants.append(
                AssistantFactory(order=order,
                                 email=order.student.user.email,
                                 enrolled=True))
Exemplo n.º 8
0
 def setUp(self):
     self.organizer = OrganizerFactory()
     self.instructor = InstructorFactory(organizer=self.organizer)
Exemplo n.º 9
0
 def setUp(self):
     self.organizer = OrganizerFactory()
     self.activities = ActivityFactory.create_batch(
         organizer=self.organizer, size=2)
Exemplo n.º 10
0
 def setUp(self):
     self.organizer = OrganizerFactory()
     BalanceFactory(organizer=self.organizer)
Exemplo n.º 11
0
 def setUp(self):
     self.organizer = OrganizerFactory()
Exemplo n.º 12
0
 def setUp(self):
     self.organizer = OrganizerFactory()
     self.organizer_message = OrganizerMessageFactory(
         organizer=self.organizer)
     self.organizer_message_student = OrganizerMessageStudentRelationFactory.create_batch(
         size=3, organizer_message=self.organizer_message)
Exemplo n.º 13
0
 def setUp(self):
     self.organizer = OrganizerFactory()
     self.location = LocationFactory(organizer=self.organizer)
Exemplo n.º 14
0
 def setUp(self):
     self.organizer = OrganizerFactory()
     self.students = StudentFactory.create_batch(2)
     self.calendar = CalendarFactory(activity__organizer=self.organizer)
Exemplo n.º 15
0
 def create_organizers(self):
     self.stdout.write('Creando organizers')
     organizers = OrganizerFactory.create_batch(self.get_quantity())
     for o in organizers:
         Balance.objects.create(organizer=o)
     return organizers