示例#1
0
    def test_create_application_raises_validation_error_when_application_is_inactive(
            self):
        self.app_info.end_date -= timezone.timedelta(days=2)
        self.app_info.save()

        with self.assertRaises(ValidationError):
            create_application(application_info=self.app_info,
                               user=self.user,
                               full_name=faker.name())
示例#2
0
    def test_create_application_raises_validation_error_when_user_has_already_applied(
            self):
        ApplicationFactory(application_info=self.app_info, user=self.user)

        with self.assertRaises(ValidationError):
            create_application(application_info=self.app_info,
                               user=self.user,
                               skype=faker.word(),
                               full_name=faker.name())
示例#3
0
    def test_create_application_creates_application_when_application_is_active_and_user_has_not_applied(
            self):
        current_application_count = Application.objects.count()

        create_application(application_info=self.app_info,
                           user=self.user,
                           skype=faker.word(),
                           full_name=faker.name())

        self.assertEqual(current_application_count + 1,
                         Application.objects.count())
示例#4
0
 def test_create_included_task_creates_task_and_included_task_when_no_existing_is_provided(
         self):
     current_task_count = Task.objects.count()
     current_included_task_count = IncludedTask.objects.count()
     create_included_task(name=faker.name(),
                          description=faker.text(),
                          gradable=faker.boolean(),
                          week=self.week,
                          course=self.course)
     self.assertEqual(current_task_count + 1, Task.objects.count())
     self.assertEqual(current_included_task_count + 1,
                      IncludedTask.objects.count())
示例#5
0
文件: factories.py 项目: vu3jej/Odin
class ProfileFactory(factory.DjangoModelFactory):
    full_name = factory.LazyAttribute(lambda _: faker.name())
    description = factory.LazyAttribute(lambda _: faker.text())

    class Meta:
        model = Profile
示例#6
0
 def test_filter_outputs_correct_solutions_when_they_exist(self):
     SolutionFactory(task=self.task, status=Solution.OK)
     name = faker.name()
     self.assertEqual(
         [self.task],
         list(self.filter.filter_solutions(self.queryset, name, 'correct')))
示例#7
0
 def test_filter_outputs_no_correct_solution_if_there_are_none(self):
     name = faker.name()
     self.assertEqual(
         [],
         list(self.filter.filter_solutions(self.queryset, name, 'correct')))
示例#8
0
文件: factories.py 项目: vu3jej/Odin
class InterviewerFactory(BaseUserFactory):
    skype = factory.LazyAttribute(lambda _: faker.name())

    class Meta:
        model = Interviewer