Ejemplo n.º 1
0
    def setUp(self):
        """Setup the ScienceProjectApprovalTest.

        Create groups and users.
        """
        # a generic user
        self.user = UserFactory.create()

        # Two user groups, SMT (Sci Mgmt Team) and SCDD (SCD Directorate)
        self.smt, created = Group.objects.get_or_create(name='SMT')
        self.scd, created = Group.objects.get_or_create(name='SCD')
        self.users, created = Group.objects.get_or_create(name='Users')

        # Bob, a research scientist, wants to create a new science project.
        # Bob will be the principal scientist of that project, add team members,
        # write project documentation, submit docs for approval, and write updates.
        self.bob = UserFactory.create(username='******',
                                      first_name='Bob',
                                      last_name='Bobson')

        # John will join Bob's team. Then he should be able to execute
        # "team-only" actions.
        self.john = UserFactory.create(username='******',
                                       first_name='John',
                                       last_name='Johnson')

        # Steven is Bob's Program Leader.
        # As a member of SMT, Steven is the first instance of approval.
        self.steven = UserFactory.create(username='******',
                                         first_name='Steven',
                                         last_name='Stevenson')
        # self.steven.groups.add(Group.objects.get(name='SMT'))
        self.steven.groups.add(self.smt)

        # Marge is the Divisional Director.
        # As member of the Directorate, M is the highest instance of approval
        # and has resurrection powers for projects.
        self.marge = UserFactory.create(username='******',
                                        first_name='Marge',
                                        last_name='Simpson')
        self.marge.groups.add(self.scd)

        # Peter won't have anything to do with the project.
        # Peter should not be able to execute any "team-only" actions!
        self.peter = UserFactory.create(username='******',
                                        first_name='Peter',
                                        last_name='Peterson')

        self.project = ScienceProjectFactory.create(
            # data_custodian=self.bob, site_custodian=self.bob,
            creator=self.bob,
            modifier=self.bob,
            project_owner=self.bob)
Ejemplo n.º 2
0
    def test_create_project_superuser(self):
        """
        Test that a superuser can add a project.
        """
        # the normal user logs in
        admin = UserFactory.create(username='******', is_superuser=True)
        self.create_preauthenticated_session(admin)

        # and clicks on "create a new project"
        url = reverse('admin:projects_project_add')
        self.selenium.get("%s%s" % (self.live_server_url, url))
        self.wait_page_loaded()

        # Project year should be shown and auto-set to current year

        # Project number should be shown and auto-set to next available
        # within current year

        #self.fail("Finish this test")
        pass
Ejemplo n.º 3
0
    def test_create_project_superuser(self):
        """
        Test that a superuser can add a project.
        """
        # the normal user logs in
        admin = UserFactory.create(username='******', is_superuser=True)
        self.create_preauthenticated_session(admin)

        # and clicks on "create a new project"
        url = reverse('admin:projects_project_add')
        self.selenium.get("%s%s" % (self.live_server_url, url))
        self.wait_page_loaded()

        # Project year should be shown and auto-set to current year

        # Project number should be shown and auto-set to next available
        # within current year

        # self.fail("Finish this test")
        pass
Ejemplo n.º 4
0
    def setUp(self):
        """Setup the ScienceProjectApprovalTest.

        Create groups and users.
        """
        # a generic user
        self.user = UserFactory.create()

        # Two user groups, SMT (Sci Mgmt Team) and SCDD (SCD Directorate)
        self.smt, created = Group.objects.get_or_create(name='SMT')
        self.scd, created = Group.objects.get_or_create(name='SCD')
        self.users, created = Group.objects.get_or_create(name='Users')

        # Bob, a research scientist, wants to create a new science project.
        # Bob will be the principal scientist of that project, add team members,
        # write project documentation, submit docs for approval, and write updates.
        self.bob = UserFactory.create(
            username='******', first_name='Bob', last_name='Bobson')

        # John will join Bob's team. Then he should be able to execute
        # "team-only" actions.
        self.john = UserFactory.create(
            username='******', first_name='John', last_name='Johnson')

        # Steven is Bob's Program Leader.
        # As a member of SMT, Steven is the first instance of approval.
        self.steven = UserFactory.create(
            username='******', first_name='Steven', last_name='Stevenson')
        # self.steven.groups.add(Group.objects.get(name='SMT'))
        self.steven.groups.add(self.smt)

        # Marge is the Divisional Director.
        # As member of the Directorate, M is the highest instance of approval and has
        # resurrection powers for projects.
        self.marge = UserFactory.create(
            username='******', first_name='Marge', last_name='Simpson')
        self.marge.groups.add(self.scd)

        # Peter won't have anything to do with the project.
        # Peter should not be able to execute any "team-only" actions!
        self.peter = UserFactory.create(
            username='******', first_name='Peter', last_name='Peterson')

        self.project = ScienceProjectFactory.create(
            # data_custodian=self.bob, site_custodian=self.bob,
            creator=self.bob, modifier=self.bob, project_owner=self.bob)
Ejemplo n.º 5
0
    def test_create_project_enduser(self):
        """
        Test whether a user can create a project.

        * Creates a standard user
        * User logs in
        * User goes to "add project" url
        * add project form opens
        * TODO what should be there
        * TODO user saves project
        * TODO what should be there

        """
        user = UserFactory.create(username='******')
        self.create_preauthenticated_session(user)
        url = reverse('admin:projects_project_add')
        self.selenium.get("%s%s" % (self.live_server_url, url))
        self.wait_page_loaded()

        # Project year and number should be hidden and auto-set

        # TODO add stuff
        #self.fail("Finish this test")
        pass
Ejemplo n.º 6
0
    def test_create_project_enduser(self):
        """
        Test whether a user can create a project.

        * Creates a standard user
        * User logs in
        * User goes to "add project" url
        * add project form opens
        * TODO what should be there
        * TODO user saves project
        * TODO what should be there

        """
        user = UserFactory.create(username='******')
        self.create_preauthenticated_session(user)
        url = reverse('admin:projects_project_add')
        self.selenium.get("%s%s" % (self.live_server_url, url))
        self.wait_page_loaded()

        # Project year and number should be hidden and auto-set

        # TODO add stuff
        # self.fail("Finish this test")
        pass
Ejemplo n.º 7
0
 def setUp(self):
     """Create a User using the UserFactory.
     """
     self.user = UserFactory.create()
Ejemplo n.º 8
0
 def setUp(self):
     """Create a User using the UserFactory.
     """
     self.user_a = UserFactory.create()
     self.user_b = UserFactory.create()
     self.superuser = SuperUserFactory.create()
Ejemplo n.º 9
0
 def setUp(self):
     """Create a User using the UserFactory.
     """
     self.user = UserFactory.create()
Ejemplo n.º 10
0
 def setUp(self):
     """Create a User using the UserFactory."""
     self.user_a = UserFactory.create()
     self.user_b = UserFactory.create()
     self.superuser = SuperUserFactory.create()