Exemple #1
0
 def setUp(self):
     """
     Sets up a test user and a `Client` with which to test.
     """
     # create two test editor groups
     EditorGroupApplicationTest.editor_group_1 = \
         EditorGroup.objects.create(name='test_editor_group_1')
     EditorGroupApplicationTest.editor_group_2 = \
         EditorGroup.objects.create(name='test_editor_group_2')
     # create two test managing editors groups
     EditorGroupApplicationTest.manager_group_1 = \
         EditorGroupManagers.objects.create(name='test_manager_group_1',
             managed_group=EditorGroupApplicationTest.editor_group_1)
     EditorGroupApplicationTest.manager_group_2 = \
         EditorGroupManagers.objects.create(name='test_manager_group_2',
             managed_group=EditorGroupApplicationTest.editor_group_2)
     # create two test managing editor users for the two created groups
     EditorGroupApplicationTest.manager_user_1 = \
         test_utils.create_manager_user('manageruser1', '*****@*****.**',
             'secret', (EditorGroupApplicationTest.editor_group_1,
                        EditorGroupApplicationTest.manager_group_1))
     EditorGroupApplicationTest.manager_user_2 = \
         test_utils.create_manager_user('manageruser2', '*****@*****.**',
             'secret', (EditorGroupApplicationTest.editor_group_2,
                        EditorGroupApplicationTest.manager_group_2))
     # create a test superuser
     EditorGroupApplicationTest.superuser = User.objects.create_superuser(
         'superuser', '*****@*****.**', 'secret')
     self.normal_user = User.objects.create_user(
         'normaluser', '*****@*****.**', 'secret')
     self.client = Client()
Exemple #2
0
 def setUpClass(cls):
     LOGGER.info("running '{}' tests...".format(cls.__name__))
     # create two test editor groups
     EditorGroupApplicationTest.editor_group_1 = \
         EditorGroup.objects.create(name='test_editor_group_1')
     EditorGroupApplicationTest.editor_group_2 = \
         EditorGroup.objects.create(name='test_editor_group_2')
     # create two test managing editors groups
     EditorGroupApplicationTest.manager_group_1 = \
         EditorGroupManagers.objects.create(name='test_manager_group_1',
             managed_group=EditorGroupApplicationTest.editor_group_1)
     EditorGroupApplicationTest.manager_group_2 = \
         EditorGroupManagers.objects.create(name='test_manager_group_2',
             managed_group=EditorGroupApplicationTest.editor_group_2)
     # create two test managing editor users for the two created groups
     EditorGroupApplicationTest.manager_user_1 = \
         test_utils.create_manager_user('manageruser1', '*****@*****.**',
             'secret', (EditorGroupApplicationTest.editor_group_1,
                        EditorGroupApplicationTest.manager_group_1))
     EditorGroupApplicationTest.manager_user_2 = \
         test_utils.create_manager_user('manageruser2', '*****@*****.**',
             'secret', (EditorGroupApplicationTest.editor_group_2,
                        EditorGroupApplicationTest.manager_group_2))
     # create a test superuser
     EditorGroupApplicationTest.superuser = User.objects.create_superuser(
         'superuser', '*****@*****.**', 'secret')
Exemple #3
0
 def setUp(self):
     """
     Sets up a test user and a `Client` with which to test.
     """
     # create two test editor groups
     EditorGroupApplicationTest.editor_group_1 = \
         EditorGroup.objects.create(name='test_editor_group_1')
     EditorGroupApplicationTest.editor_group_2 = \
         EditorGroup.objects.create(name='test_editor_group_2')
     # create two test managing editors groups
     EditorGroupApplicationTest.manager_group_1 = \
         EditorGroupManagers.objects.create(name='test_manager_group_1',
             managed_group=EditorGroupApplicationTest.editor_group_1)
     EditorGroupApplicationTest.manager_group_2 = \
         EditorGroupManagers.objects.create(name='test_manager_group_2',
             managed_group=EditorGroupApplicationTest.editor_group_2)
     # create two test managing editor users for the two created groups
     EditorGroupApplicationTest.manager_user_1 = \
         test_utils.create_manager_user('manageruser1', '*****@*****.**',
             'secret', (EditorGroupApplicationTest.editor_group_1,
                        EditorGroupApplicationTest.manager_group_1))
     EditorGroupApplicationTest.manager_user_2 = \
         test_utils.create_manager_user('manageruser2', '*****@*****.**',
             'secret', (EditorGroupApplicationTest.editor_group_2,
                        EditorGroupApplicationTest.manager_group_2))
     # create a test superuser
     EditorGroupApplicationTest.superuser = User.objects.create_superuser(
         'superuser', '*****@*****.**', 'secret')
     self.normal_user = User.objects.create_user('normaluser',
                                                 '*****@*****.**',
                                                 'secret')
     self.client = Client()
Exemple #4
0
 def setUp(self):
     """
     Set up the detail view
     """
     test_utils.setup_test_storage()
     create_user('normaluser', '*****@*****.**', 'secret')
     _test_editor_group = EditorGroup.objects.create(
                                                 name='test_editor_group')
     self.resource = _import_resource('testfixture.xml',
                                      _test_editor_group)
     ViewTest.test_editor = test_utils.create_editor_user('editoruser',
         '*****@*****.**', 'secret', (_test_editor_group,))          
     test_utils.create_manager_user('manageruser', '*****@*****.**',
         'secret', (EditorGroupManagers.objects.create(
                         name='test_editor_group_manager',
                         managed_group=_test_editor_group),))
Exemple #5
0
 def setUp(self):
     """
     Set up the detail view
     """
     test_utils.setup_test_storage()
     create_user('normaluser', '*****@*****.**', 'secret')
     _test_editor_group = EditorGroup.objects.create(
                                                 name='test_editor_group')
     self.resource = _import_resource('testfixture.xml',
                                      _test_editor_group)
     ViewTest.test_editor = test_utils.create_editor_user('editoruser',
         '*****@*****.**', 'secret', (_test_editor_group,))          
     test_utils.create_manager_user('manageruser', '*****@*****.**',
         'secret', (EditorGroupManagers.objects.create(
                         name='test_editor_group_manager',
                         managed_group=_test_editor_group),))
Exemple #6
0
 def setUpClass(cls):
     """
     Import a resource to test the workflow changes for
     """
     LOGGER.info("running '{}' tests...".format(cls.__name__))
     test_utils.set_index_active(False)        
     test_utils.setup_test_storage()
     _test_editor_group = \
         EditorGroup.objects.create(name='test_editor_group')
     _test_manager_group = \
         EditorGroupManagers.objects.create(name='test_manager_group',
                                            managed_group=_test_editor_group)            
     owner = test_utils.create_manager_user(
         'manageruser', '*****@*****.**', 'secret',
         (_test_editor_group, _test_manager_group))       
     
     # load first resource
     _fixture = '{0}/repository/fixtures/testfixture.xml'.format(ROOT_PATH)
     _result = test_utils.import_xml(_fixture)
     _result.editor_groups.add(_test_editor_group)
     _result.owners.add(owner)
     # load second resource
     _fixture = '{0}/repository/test_fixtures/ingested-corpus-AudioVideo-French.xml'.format(ROOT_PATH)
     _result = test_utils.import_xml(_fixture)
     _result.editor_groups.add(_test_editor_group)
     _result.owners.add(owner)
     
     # create a normal user
     test_utils.create_user('user', '*****@*****.**', 'mypasswd')
Exemple #7
0
    def setUpClass(cls):
        """
        Import a resource to test the workflow changes for
        """
        LOGGER.info("running '{}' tests...".format(cls.__name__))
        test_utils.set_index_active(False)
        test_utils.setup_test_storage()
        _test_editor_group = \
            EditorGroup.objects.create(name='test_editor_group')
        _test_manager_group = \
            EditorGroupManagers.objects.create(name='test_manager_group',
                                               managed_group=_test_editor_group)
        owner = test_utils.create_manager_user(
            'manageruser', '*****@*****.**', 'secret',
            (_test_editor_group, _test_manager_group))

        # load first resource
        _fixture = '{0}/repository/fixtures/testfixture.xml'.format(ROOT_PATH)
        _result = test_utils.import_xml(_fixture)
        _result.editor_groups.add(_test_editor_group)
        _result.owners.add(owner)
        # load second resource
        _fixture = '{0}/repository/test_fixtures/ingested-corpus-AudioVideo-French.xml'.format(
            ROOT_PATH)
        _result = test_utils.import_xml(_fixture)
        _result.editor_groups.add(_test_editor_group)
        _result.owners.add(owner)

        # create a normal user
        test_utils.create_user('user', '*****@*****.**', 'mypasswd')
    def setUp(self):
        """
        Import a resource to test the workflow changes for
        """
        test_utils.set_index_active(False)
        test_utils.setup_test_storage()
        _test_editor_group = \
            EditorGroup.objects.create(name='test_editor_group')
        _test_manager_group = \
            EditorGroupManagers.objects.create(name='test_manager_group',
                                               managed_group=_test_editor_group)
        test_utils.create_manager_user(
            'manageruser', '*****@*****.**', 'secret',
            (_test_editor_group, _test_manager_group))

        _fixture = '{0}/repository/fixtures/testfixture.xml'.format(ROOT_PATH)
        _result = test_utils.import_xml(_fixture)
        _result.editor_groups.add(_test_editor_group)
        StatusWorkflowTest.resource_id = _result.id
 def setUp(self):
     """
     Import a resource to test the workflow changes for
     """
     test_utils.set_index_active(False)
     test_utils.setup_test_storage()
     _test_editor_group = \
         EditorGroup.objects.create(name='test_editor_group')
     _test_manager_group = \
         EditorGroupManagers.objects.create(name='test_manager_group',
                                            managed_group=_test_editor_group)
     test_utils.create_manager_user(
         'manageruser', '*****@*****.**', 'secret',
         (_test_editor_group, _test_manager_group))
     
     _fixture = '{0}/repository/fixtures/testfixture.xml'.format(ROOT_PATH)
     _result = test_utils.import_xml(_fixture)
     _result.editor_groups.add(_test_editor_group)
     StatusWorkflowTest.resource_id = _result.id
Exemple #10
0
 def setUp(self):
     # create an editor group and a manager group for this group
     self.test_editor_group = EditorGroup.objects.create(
         name='test_editor_group')
     self.test_manager_group = ManagerGroup.objects.create(
         name='test_manager_group', managed_group=self.test_editor_group)
     # create an editor group managing user
     test_utils.create_manager_user('manageruser', '*****@*****.**',
         'secret', (self.test_editor_group, self.test_manager_group))
     # create an editor user
     test_utils.create_editor_user('editoruser', '*****@*****.**',
                                   'secret', (self.test_editor_group,))
     # make sure the index does not contain any stale entries
     call_command('rebuild_index', interactive=False, using=settings.TEST_MODE_NAME)
     
     # init Selenium
     driver = getattr(webdriver, settings.SELENIUM_DRIVER, None)
     assert driver, "settings.SELENIUM_DRIVER contains non-existing driver"
     self.driver = driver()
     self.driver.implicitly_wait(30)
     host = getattr(settings, 'SELENIUM_TESTSERVER_HOST', 'localhost')
     port = getattr(settings, 'SELENIUM_TESTSERVER_PORT', 8000)
     self.base_url = 'http://{0}:{1}/{2}'.format(host, port, DJANGO_BASE)
     self.verification_errors = []
Exemple #11
0
    def setUp(self):
        # create an editor group and a manager group for this group
        self.test_editor_group = EditorGroup.objects.create(
            name='test_editor_group')
        self.test_manager_group = EditorGroupManagers.objects.create(
            name='test_manager_group', managed_group=self.test_editor_group)
        # create an editor group managing user
        self.manager_user = test_utils.create_manager_user('manageruser',
            '*****@*****.**', 'secret',
            (self.test_editor_group, self.test_manager_group))
        self.manager_user.get_profile().default_editor_groups \
            .add(self.test_editor_group)

        # create an editor user
        test_utils.create_editor_user('editoruser', '*****@*****.**',
                                      'secret', (self.test_editor_group,))
        # make sure the index does not contain any stale entries
        call_command('rebuild_index', interactive=False, using=settings.TEST_MODE_NAME)

        super(EditorTest, self).setUp()
        self.base_url = 'http://{}:{}/{}' \
            .format(self.testserver_host, self.testserver_port, DJANGO_BASE)
        self.verification_errors = []
Exemple #12
0
    def setUpClass(cls):
        """
        set up test users with and without staff permissions.
        These will live in the test database only, so will not
        pollute the "normal" development db or the production db.
        As a consequence, they need no valuable password.
        """
        EditorTest.test_editor_group = EditorGroup.objects.create(
                                                    name='test_editor_group')
        EditorTest.test_manager_group = \
            ManagerGroup.objects.create(name='test_manager_group',
                                    managed_group=EditorTest.test_editor_group)

        staffuser = User.objects.create_user('staffuser', '*****@*****.**',
          'secret')
        staffuser.is_staff = True
        staffuser.save()
        
        User.objects.create_user('normaluser', '*****@*****.**', 'secret')

        editoruser = test_utils.create_editor_user('editoruser',
            '*****@*****.**', 'secret', (EditorTest.test_editor_group,))

        test_utils.create_manager_user(
            'manageruser', '*****@*****.**', 'secret',
            (EditorTest.test_editor_group, EditorTest.test_manager_group))

        User.objects.create_superuser('superuser', '*****@*****.**', 'secret')

        # login POST dicts
        EditorTest.staff_login = {
            REDIRECT_FIELD_NAME: ADMINROOT,
            LOGIN_FORM_KEY: 1,
            'username': '******',
            'password': '******',
        }

        EditorTest.normal_login = {
            REDIRECT_FIELD_NAME: ADMINROOT,
            LOGIN_FORM_KEY: 1,
            'username': '******',
            'password': '******',
        }
        
        EditorTest.editor_login = {
            REDIRECT_FIELD_NAME: ADMINROOT,
            LOGIN_FORM_KEY: 1,
            'username': '******',
            'password': '******',
        }
        
        EditorTest.manager_login = {
            REDIRECT_FIELD_NAME: ADMINROOT,
            LOGIN_FORM_KEY: 1,
            'username': '******',
            'password': '******',
        }
        
        EditorTest.superuser_login = {
            REDIRECT_FIELD_NAME: ADMINROOT,
            LOGIN_FORM_KEY: 1,
            'username': '******',
            'password': '******',
        }
        
        EditorTest.testfixture = cls.import_test_resource(
                                                EditorTest.test_editor_group)
        # second resource which is only visible by the superuser
        EditorTest.testfixture2 = cls.import_test_resource(None,
                                                           TESTFIXTURE2_XML)
        # third resource which is owned by the editoruser
        EditorTest.testfixture3 = cls.import_test_resource(None,
                                                           TESTFIXTURE3_XML)
        EditorTest.testfixture3.owners.add(editoruser)
        EditorTest.testfixture3.save()