Exemple #1
0
    def test_print_cover_supervisor(self):
        username = '******'
        self._create_and_login_user(username=username)
        result_form = create_result_form(form_state=FormState.CLEARANCE,
                                         station_number=42)
        create_clearance(result_form, self.user, reviewed_team=True)
        self._create_and_login_user()
        self._add_user_to_group(self.user, groups.CLEARANCE_SUPERVISOR)
        request = self.factory.get('/')
        request.user = self.user
        request.session = {'result_form': result_form.pk}
        view = views.PrintCoverView.as_view()
        response = view(request)

        self.assertContains(response, 'Clearance Case')
        self.assertContains(response, '42')
Exemple #2
0
    def test_print_cover_clerk(self):
        username = '******'
        self._create_and_login_user(username=username)
        result_form = create_result_form(form_state=FormState.CLEARANCE,
                                         station_number=42)
        create_clearance(result_form, self.user, reviewed_team=True)
        date_str = Template("{{k}}").render(
            Context({'k': result_form.clearance.date_team_modified}))
        self._add_user_to_group(self.user, groups.CLEARANCE_CLERK)
        request = self.factory.get('/')
        request.user = self.user
        request.session = {'result_form': result_form.pk}
        view = views.PrintCoverView.as_view()
        response = view(request)

        self.assertContains(response, 'Clearance Case')
        self.assertContains(response, '42')
        self.assertContains(response, date_str)
Exemple #3
0
    def test_dashboard_get_supervisor(self):
        username = '******'
        self._create_and_login_user(username=username)
        tally = create_tally()
        tally.users.add(self.user)
        result_form = create_result_form(form_state=FormState.CLEARANCE,
                                         station_number=42,
                                         tally=tally)
        create_clearance(result_form, self.user, reviewed_team=True)

        self._create_and_login_user()
        self._add_user_to_group(self.user, groups.CLEARANCE_SUPERVISOR)
        tally.users.add(self.user)

        request = self.factory.get('/')
        request.user = self.user
        view = views.DashboardView.as_view()
        response = view(request, tally_id=tally.pk)

        self.assertContains(response, 'Clearance')
        self.assertContains(response, username)
        self.assertContains(response, '42')
Exemple #4
0
    def test_dashboard_get_supervisor(self):
        username = '******'
        self._create_and_login_user(username=username)
        tally = create_tally()
        tally.users.add(self.user)
        result_form = create_result_form(form_state=FormState.CLEARANCE,
                                         station_number=42,
                                         tally=tally)
        create_clearance(result_form, self.user, reviewed_team=True)

        self._create_and_login_user()
        self._add_user_to_group(self.user, groups.CLEARANCE_SUPERVISOR)
        tally.users.add(self.user)

        request = self.factory.get('/')
        request.user = self.user
        view = views.DashboardView.as_view()
        response = view(request, tally_id=tally.pk)

        self.assertContains(response, 'Clearance')
        self.assertContains(response, username)
        self.assertContains(response, '42')