Exemple #1
0
    def test_project_real_type(self):

        self.assertEqual(self.project, self.project.real_type)

        sprint = FakeSprintAutomatedFactory()
        self.assertEqual(sprint, sprint.real_type)
        self.assertEqual(sprint, sprint.project_ptr.real_type)
Exemple #2
0
    def test_project_is_type_property(self):

        project = self.create_project()
        self.assertFalse(project.is_sprint)

        sprint = FakeSprintAutomatedFactory()
        self.assertTrue(sprint.is_sprintautomated)
Exemple #3
0
 def setUp(self):
     super().setUp()
     self.create_superuser()
     self.consultant = FakeConsultantFactory(status=settings.CONSULTANT_STATUS_CH_ACTIVE)
     self.sprint = FakeSprintAutomatedFactory(status=settings.PROJECT_CH_PROJECT_STATUS_STARTED)
     # Sprint Teams
     self.team_s_a = FakeTeamFactory.create(project=self.sprint.project_ptr)
     self.team_s_b = FakeTeamFactory.create(project=self.sprint.project_ptr)
Exemple #4
0
    def test_project_type_project(self):

        self.assertEqual(self.project, self.project.real_type)

        sprint = FakeSprintAutomatedFactory()
        self.assertEqual(
            sprint.type_project.lower(),
            SprintAutomated._meta.model_name,
        )
 def test_create_generic_typeform_feedback(self):
     sprint = FakeSprintAutomatedFactory()
     self.assertTrue(sprint.steps.exists())
     # There are typeform feedback for each step, except the first one
     for step in sprint.steps.filter(index__gt=1):
         for step_stream in step.streams.all():
             self.assertTrue(step_stream.typeform_feedback.exists())
     # the first step doesn't have feedback
     step = sprint.steps.first()
     for step_stream in step.streams.all():
         self.assertFalse(step_stream.typeform_feedback.exists())
Exemple #6
0
    def test_project_verbose_real_type(self):

        sprint = FakeSprintAutomatedFactory()
        self.assertEqual(
            sprint.project_ptr.type_verbose_name,
            sprint._meta.verbose_name,
        )

        fastrack = FakeFastrackFactory()
        self.assertEqual(
            fastrack.project_ptr.type_verbose_name,
            fastrack._meta.verbose_name,
        )
Exemple #7
0
    def _build_sprint(self, number_of_members=2):
        sprint = FakeSprintAutomatedFactory()
        team_members = [{
            'email': faker.email(),
            'short_name': faker.name(),
        } for _ in range(1, number_of_members + 1)]

        project = sprint.project_ptr
        consultant = FakeConsultantFactory()
        team = Team.objects.create(
            project=project,
            user_from=self.super_user,
            created_by=self.super_user,
            name=faker.name(),
            coach=consultant,
            stream=settings.PROJECT_STREAM_CH_STRATEGY,
            team_members=team_members,
        )
        return sprint, team, consultant
Exemple #8
0
    def test_edit_project_settings_form(self):
        # PREPARE DATA
        self.client.login(username=self.super_user.username, password='******')
        sprint = FakeSprintAutomatedFactory()
        url = reverse('project:project:settings', args=[sprint.pk])

        # DO ACTION
        response = self.client.get(url)

        # ASSERTS
        initial = response.context.get('form').initial
        self.assertFalse(initial['send_welcome_consultant'])
        self.assertFalse(initial['send_welcome_participant'])
        self.assertEqual(initial['fix_password'], '')
        self.assertFalse(initial['participant_step_feedback_enabled'])
        self.assertTrue(initial['directory_enabled'])

        # PREPARE DATA
        new_data = {
            'send_welcome_consultant': True,
            'send_welcome_participant': True,
            'fix_password': faker.name(),
            'participant_step_feedback_enabled': False,
            'version': settings.PROJECT_CH_VERSION_DEFAULT,
            'directory_enabled': False,
            'advisor_request_enabled': True,
            'num_tickets_per_team': 5,
            'tickets_price': 200,
            'tickets_currency': settings.OPPORTUNITIES_CH_CURRENCY_EXOS,
        }

        # DO ACTION
        response = self.client.post(url, data=new_data)

        # ASSERTS
        sprint_settings = sprint.settings
        self.assertTrue(sprint_settings.launch['send_welcome_consultant'])
        self.assertTrue(sprint_settings.launch['send_welcome_participant'])
        self.assertEqual(sprint_settings.launch['fix_password'],
                         new_data.get('fix_password'))
        self.assertFalse(sprint_settings.participant_step_feedback_enabled)
        self.assertFalse(sprint_settings.directory)
    def create_project(self):
        sprint = FakeSprintAutomatedFactory(
            id=self.data.get('id'),
            uuid=self.data.get('uuid', uuid.uuid4()),
            name=self.data.get('name'),
            customer=self.data.get('customer'),
            duration=settings.SPRINT_AUTOMATED_STEPS_COUNT,
            lapse=settings.PROJECT_LAPSE_PERIOD,
            start=self.data.get('start'),
            location=self.data.get('place').get('name'),
            place_id=self.data.get('place').get('place_id'),
        )

        user = self.data.get('created_by')
        if user and isinstance(user, Consultant):
            sprint.created_by = user.user
        else:
            sprint.created_by = user
        sprint.save()
        return sprint
Exemple #10
0
    def test_edit_service_sprint_from_django_form(self, mock):
        # PREPARE DATA
        sprint = FakeSprintAutomatedFactory()
        new_date = '2013-01-01 10:00:00'
        sprint_form = SprintSimpleForm(instance=sprint)
        data = sprint_form.initial
        data['start'] = new_date
        data['agenda'] = ''
        data['location'] = faker.city()
        data['timezone'] = faker.timezone()
        data['place_id'] = faker.pyint()
        url = reverse('project:project:dashboard',
                      kwargs={'project_id': sprint.id})
        self.client.login(username=self.super_user.username, password='******')

        # DO ACTION
        response = self.client.post(url, data=data, format='json')

        # ASSERTS
        self.assertTrue(status.is_success(response.status_code))
 def setUp(self):
     super().setUp()
     self.create_superuser()
     self.consultant = FakeConsultantFactory(status=settings.CONSULTANT_STATUS_CH_ACTIVE)
     self.sprint = FakeSprintAutomatedFactory(status=settings.PROJECT_CH_PROJECT_STATUS_WAITING)