Beispiel #1
0
    def test_visible_in_project_false_if_not_approved(self):
        scenario = ScenarioF.create()
        project = ProjectF.create()
        scenario.set_project(project)

        pm = permission_manager.AnonymousPermissionManager()

        self.assertFalse(scenario.visible_in_project(pm, project))
Beispiel #2
0
    def test_visible_in_project_true_if_approved(self):
        scenario = ScenarioF.create()
        project = ProjectF.create()
        scenario.set_project(project)

        scenarioproject = scenario.scenarioproject(project)
        scenarioproject.approved = True
        scenarioproject.save()

        pm = permission_manager.AnonymousPermissionManager()

        self.assertTrue(scenario.visible_in_project(pm, project))
Beispiel #3
0
    def test_scenarios(self):
        """If we have a Group named 'demo group', and a scenario in a
        project where that groep has view permission, we should be
        able to see it."""

        group = Group(name='demo group')
        group.save()

        project = ProjectF.create()

        group.projectgrouppermission_set.add(
            ProjectGroupPermission(
                group=group,
                project=project,
                permission=UserPermission.PERMISSION_SCENARIO_VIEW))

        scenario = ScenarioF.create(status_cache=Scenario.STATUS_APPROVED)
        scenario.set_project(project)

        pm = permission_manager.AnonymousPermissionManager()
        self.assertTrue(scenario.id in (s.id for s in pm.get_scenarios()))