예제 #1
0
 def setUp(self):
     
     test_utils.setup_test_storage()
     _fixture = '{0}/repository/fixtures/testfixture.xml'.format(ROOT_PATH)
     _result = test_utils.import_xml(_fixture)
     self.resource_id = _result[0].id
     resource = resourceInfoType_model.objects.get(pk=self.resource_id)
     resource.storage_object.published = True
     resource.storage_object.save()
     # 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.
     staffuser = User.objects.create_user('staffuser', '*****@*****.**',
       'secret')
     staffuser.is_staff = True
     staffuser.save()
     User.objects.create_user('normaluser', '*****@*****.**', 'secret')
     
     # 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', 8011)
     self.base_url = 'http://{0}:{1}/{2}'.format(host, port, DJANGO_BASE)
     self.verification_errors = []
예제 #2
0
 def setUp(self):
     """
     Imports a few test resources.
     """
     test_utils.setup_test_storage()
     self.test_res_1 = test_utils.import_xml("{0}/repository/fixtures/testfixture.xml".format(ROOT_PATH))
     self.test_res_2 = test_utils.import_xml("{0}/repository/fixtures/ILSP10.xml".format(ROOT_PATH))
예제 #3
0
파일: tests.py 프로젝트: Atala/META-SHARE
 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')
예제 #4
0
파일: tests.py 프로젝트: MiltosD/CEFELRC
 def setUp(self):
     """
     Import test fixtures and add resource pairs to TogetherManager
     """
     test_utils.setup_test_storage()
     self.res_1 = _import_resource('elra112.xml')
     self.res_2 = _import_resource('elra135.xml')
     self.res_3 = _import_resource('elra260.xml')
     self.res_4 = _import_resource('elra295.xml')
     man = TogetherManager.getManager(Resource.VIEW)
     count = 0
     while (count < 5):
         man.addResourcePair(self.res_1, self.res_2)
         count += 1
     count = 0
     while (count < 10):
         man.addResourcePair(self.res_1, self.res_3)
         count += 1
     count = 0
     while (count < 3):
         man.addResourcePair(self.res_1, self.res_4)
         count += 1
     man = TogetherManager.getManager(Resource.DOWNLOAD)
     count = 0
     while (count < 15):
         man.addResourcePair(self.res_1, self.res_2)
         count += 1
     count = 0
     while (count < 10):
         man.addResourcePair(self.res_1, self.res_3)
         count += 1
     count = 0
     while (count < 5):
         man.addResourcePair(self.res_1, self.res_4)
         count += 1
예제 #5
0
 def setUp(self):
     """
     Sets up some resources with which to test.
     """
     test_utils.setup_test_storage()
     # set up different test resources
     self.non_downloadable_resource = _import_resource('testfixture.xml')
     self.downloadable_resource_1 = \
         _import_resource('downloadable_1_license.xml')
     self.ms_commons_resource = \
         _import_resource('downloadable_ms_commons_license.xml')
     # set up test users with/without staff permissions and with/without
     # META-SHARE full membership
     staffuser = create_user('staffuser', '*****@*****.**', 'secret')
     staffuser.is_staff = True
     staffuser.save()
     create_user('normaluser', '*****@*****.**', 'secret')
     profile_ct = ContentType.objects.get_for_model(UserProfile)
     ms_member = create_user('fullmember', '*****@*****.**', 'secret')
     ms_member.user_permissions.add(Permission.objects.get(
                 content_type=profile_ct, codename='ms_full_member'))
     ms_member.save()
     ms_member = create_user('associatemember', '*****@*****.**', 'secret')
     ms_member.user_permissions.add(Permission.objects.get(
                 content_type=profile_ct, codename='ms_associate_member'))
     ms_member.save()
예제 #6
0
 def setUp(self):
     """
     Set up the view
     """
     test_utils.setup_test_storage()                        
     normaluser =  create_user('normaluser', '*****@*****.**', 'secret')
     normaluser.save()
예제 #7
0
 def setUp(self):
     """
     Set up the view
     """
     test_utils.setup_test_storage()
     normaluser = create_user('normaluser', '*****@*****.**', 'secret')
     normaluser.save()
예제 #8
0
 def setUp(self):
     """
     Import test fixtures and add resource pairs to TogetherManager
     """
     test_utils.setup_test_storage()
     self.res_1 = _import_resource('elra112.xml')
     self.res_2 = _import_resource('elra135.xml')
     self.res_3 = _import_resource('elra260.xml')
     self.res_4 = _import_resource('elra295.xml')
     man = TogetherManager.getManager(Resource.VIEW)
     count = 0
     while (count < 5):
         man.addResourcePair(self.res_1, self.res_2)
         count += 1
     count = 0
     while (count < 10):
         man.addResourcePair(self.res_1, self.res_3)
         count += 1
     count = 0
     while (count < 3):
         man.addResourcePair(self.res_1, self.res_4)
         count += 1
     man = TogetherManager.getManager(Resource.DOWNLOAD)
     count = 0
     while (count < 15):
         man.addResourcePair(self.res_1, self.res_2)
         count += 1
     count = 0
     while (count < 10):
         man.addResourcePair(self.res_1, self.res_3)
         count += 1
     count = 0
     while (count < 5):
         man.addResourcePair(self.res_1, self.res_4)
         count += 1
예제 #9
0
 def setUpClass(cls):
     """
     Set up the view
     """
     LOGGER.info("running '{}' tests...".format(cls.__name__))
     test_utils.setup_test_storage()
     cls.importPublishedFixtures()
예제 #10
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')
예제 #11
0
    def setUpClass(cls):
        """
        Set up the test
        """
        LOGGER.info("running '{}' tests...".format(cls.__name__))

        # disable indexing during import
        test_utils.set_index_active(False)

        # import resources
        test_utils.setup_test_storage()
        OBJECT_XML_CACHE.clear()
        test_utils.import_xml_or_zip("{}/repository/fixtures/full-resources/"
                                     "partial-corpus.xml".format(ROOT_PATH))
        test_utils.import_xml_or_zip(
            "{}/repository/fixtures/full-resources/"
            "full-lang-description.xml".format(ROOT_PATH))
        test_utils.import_xml_or_zip(
            "{}/repository/fixtures/full-resources/"
            "full-lex-conceptual.xml".format(ROOT_PATH))
        test_utils.import_xml_or_zip("{}/repository/fixtures/full-resources/"
                                     "full-corpus-text.xml".format(ROOT_PATH))
        test_utils.import_xml_or_zip("{}/repository/fixtures/full-resources/"
                                     "full-tool-service.xml".format(ROOT_PATH))

        # enable indexing
        test_utils.set_index_active(True)

        # update index
        update_index.Command().handle(using=[
            settings.TEST_MODE_NAME,
        ])
예제 #12
0
파일: tests.py 프로젝트: MiltosD/ELRC2
    def setUp(self):
        """
        Import a resource to test the workflow changes for
        """
        test_utils.set_index_active(False)
        test_utils.setup_test_storage()
        # create Groups
        trgroup = Group.objects.create(name="technicalReviewers")
        ecgroup = Group.objects.create(name='ecmembers')

        owner = User.objects.create_user('ecuser', '*****@*****.**',
                                         'secret')
        owner.groups.add(ecgroup)
        owner.is_staff = True
        owner.save()

        # create a superuser
        su = User.objects.create_user('su', '*****@*****.**', 'supwd')
        su.is_superuser = True
        su.is_staff = True
        su.save()

        # load first resource
        _fixture = '{0}/repository/fixtures/testfixture.xml'.format(ROOT_PATH)
        _result = test_utils.import_xml(_fixture)
        _result.owners.add(su)
        # load second resource
        _fixture = '{0}/repository/test_fixtures/ingested-corpus-text-French.xml'.format(
            ROOT_PATH)
        _result = test_utils.import_xml(_fixture)
        _result.owners.add(su)
예제 #13
0
 def import_test_resource(cls, editor_group=None, path=TESTFIXTURE_XML):
     test_utils.setup_test_storage()
     result = test_utils.import_xml(path)
     resource = result[0]
     if not editor_group is None:
         resource.editor_groups.add(editor_group)
         resource.save()
     return resource
예제 #14
0
 def setUp(self):
     """
     Set up the email test
     """
     test_utils.setup_test_storage()
     _fixture = '{0}/repository/fixtures/testfixture.xml'.format(ROOT_PATH)
     _result = test_utils.import_xml(_fixture)
     self.resource_id = _result[0].id
예제 #15
0
 def setUp(self):
     """
     Import a resource to test the workflow changes for
     """
     test_utils.setup_test_storage()
     _fixture = '{0}/repo2/fixtures/testfixture.xml'.format(ROOT_PATH)
     _result = test_utils.import_xml(_fixture)
     self.resource_id = _result[0].id
예제 #16
0
파일: tests.py 프로젝트: MiltosD/CEFELRC
 def setUp(self):
     """
     Import test fixtures and add resource pairs to TogetherManager
     """
     test_utils.setup_test_storage()
     self.res_1 = _import_resource('elra112.xml')
     self.res_2 = _import_resource('elra135.xml')
     self.res_3 = _import_resource('elra260.xml')
예제 #17
0
 def setUp(self):
     """
     Set up the email test
     """
     test_utils.setup_test_storage()
     _fixture = '{0}/repository/fixtures/testfixture.xml'.format(ROOT_PATH)
     _result = test_utils.import_xml(_fixture)
     self.resource_id = _result.id
예제 #18
0
 def setUp(self):
     """
     Import test fixtures and add resource pairs to TogetherManager
     """
     test_utils.setup_test_storage()
     self.res_1 = _import_resource('elra112.xml')
     self.res_2 = _import_resource('elra135.xml')
     self.res_3 = _import_resource('elra260.xml')
예제 #19
0
 def setUpClass(cls):
     """
     Set up the view
     """
     LOGGER.info("running '{}' tests...".format(cls.__name__))
     test_utils.setup_test_storage()                        
     # Make sure the index does not contain any stale entries:
     call_command('rebuild_index', interactive=False, using=settings.TEST_MODE_NAME)
     cls.importPublishedFixtures()
예제 #20
0
 def setUpClass(cls):
     """
     Set up the view
     """
     LOGGER.info("running '{}' tests...".format(cls.__name__))
     test_utils.setup_test_storage()                        
     # Make sure the index does not contain any stale entries:
     call_command('rebuild_index', interactive=False, using=settings.TEST_MODE_NAME)
     cls.importPublishedFixtures()
예제 #21
0
파일: tests.py 프로젝트: MiltosD/CEFELRC
 def setUp(self):
     """
     Creates a new storage object instance for testing.
     """
     test_utils.setup_test_storage()
     self.client = Client()
     self._minimal_xml = u"""<?xml version="1.0"?>\n<foo/>"""
     obj = StorageObject.objects.create(metadata=self._minimal_xml)
     self.object_id = obj.id
예제 #22
0
 def import_test_resource(cls, filename, status):
     test_utils.setup_test_storage()
     _fixture = '{0}/repository/fixtures/{1}'.format(settings.ROOT_PATH, filename)
     result = test_utils.import_xml(_fixture)
     resource = result[0]
     resource.storage_object.publication_status = status
     resource.storage_object.save()
     resource.storage_object.update_storage()
     return resource
 def setUp(self):
     """
     Import test fixtures and add resource pairs to TogetherManager
     """
     test_utils.setup_test_storage()
     self.res_1 = _import_resource('creators-projects-1.xml')
     self.res_2 = _import_resource('creators-projects-2.xml')
     self.res_3 = _import_resource('creators-projects-3.xml')
     self.res_4 = _import_resource('creators-projects-4.xml')
예제 #24
0
 def setUp(self):
     """
     Set up the email test
     """
     test_utils.setup_test_storage()
     _fixture = '{0}/repository/fixtures/testfixture.xml'.format(ROOT_PATH)
     self.resource = test_utils.import_xml(_fixture)
     self.resource.storage_object.published = True
     self.resource.storage_object.save()
예제 #25
0
 def setUp(self):
     """
     Imports a few test resources.
     """
     test_utils.setup_test_storage()
     self.test_res_1 = test_utils.import_xml(
         '{0}/repository/fixtures/testfixture.xml'.format(ROOT_PATH))
     self.test_res_2 = test_utils.import_xml(
         '{0}/repository/fixtures/ILSP10.xml'.format(ROOT_PATH))
예제 #26
0
파일: test_email.py 프로젝트: MiltosD/ELRC2
 def setUp(self):
     """
     Set up the email test
     """
     test_utils.setup_test_storage()
     _fixture = '{0}/repository/fixtures/testfixture.xml'.format(ROOT_PATH)
     self.resource = test_utils.import_xml(_fixture)
     self.resource.storage_object.published = True
     self.resource.storage_object.save()
예제 #27
0
 def setUp(self):
     """
     Set up the test
     """
     test_utils.setup_test_storage()
     clear_index.Command().handle(using=[
         settings.TEST_MODE_NAME,
     ],
                                  interactive=False)
예제 #28
0
파일: tests.py 프로젝트: MiltosD/ELRC2
 def setUp(self):
     """
     Creates a new storage object instance for testing.
     """
     test_utils.setup_test_storage()
     self.client = Client()
     self._minimal_xml = u"""<?xml version="1.0"?>\n<foo/>"""
     obj = StorageObject.objects.create(metadata=self._minimal_xml)
     self.object_id = obj.id
 def setUp(self):
     """
     Import test fixtures and add resource pairs to TogetherManager
     """
     test_utils.setup_test_storage()
     self.res_1 = _import_resource('creators-projects-1.xml')
     self.res_2 = _import_resource('creators-projects-2.xml')
     self.res_3 = _import_resource('creators-projects-3.xml')
     self.res_4 = _import_resource('creators-projects-4.xml')
     update_index.Command().handle(using=[settings.TEST_MODE_NAME,])
예제 #30
0
    def setUp(self):
        """
        Set up the import test
        """        
        test_utils.setup_test_storage()
        
        ImportTest.test_editor_group = EditorGroup.objects.create(
                                                    name='test_editor_group')

        ImportTest.super_user = User.objects.create_superuser('superuser', '*****@*****.**', 'secret')
예제 #31
0
    def setUp(self):
        """
        Set up the view
        """
        test_utils.setup_test_storage()

        staffuser = create_user("staffuser", "*****@*****.**", "secret")
        staffuser.is_staff = True
        staffuser.save()
        normaluser = create_user("normaluser", "*****@*****.**", "secret")
        normaluser.save()
예제 #32
0
    def setUp(self):
        """
        Set up the import test
        """
        test_utils.setup_test_storage()

        ImportTest.test_editor_group = EditorGroup.objects.create(
            name='test_editor_group')

        ImportTest.super_user = User.objects.create_superuser(
            'superuser', '*****@*****.**', 'secret')
예제 #33
0
    def setUpClass(cls):
        """
        set up test users with and without sync 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.
        """
        LOGGER.info("running '{}' tests...".format(cls.__name__))

        set_index_active(False)
        test_utils.setup_test_storage()
        syncuser = User.objects.create_user('syncuser', '*****@*****.**',
                                            'secret')
        syncpermission = Permission.objects.get(codename='can_sync')
        syncuser.user_permissions.add(syncpermission)
        syncuser.save()

        User.objects.create_user('normaluser', '*****@*****.**', 'secret')

        editoruser = User.objects.create_user('editoruser',
                                              '*****@*****.**', 'secret')
        editoruser.is_staff = True
        globaleditors = Group.objects.get(name='globaleditors')
        editoruser.groups.add(globaleditors)
        editoruser.save()

        # login POST dicts
        MetadataSyncTest.syncuser_login = {
            LOGIN_FORM_KEY: 1,
            'username': '******',
            'password': '******',
        }

        MetadataSyncTest.normal_login = {
            LOGIN_FORM_KEY: 1,
            'username': '******',
            'password': '******',
        }

        MetadataSyncTest.editor_login = {
            LOGIN_FORM_KEY: 1,
            'username': '******',
            'password': '******',
        }

        testres = cls.import_test_resource('testfixture.xml', INGESTED)
        testres.storage_object.digest_modified = datetime.date(2012, 6, 1)
        testres.storage_object.save()

        cls.import_test_resource('roundtrip.xml', INTERNAL)

        pubres = cls.import_test_resource('ILSP10.xml', PUBLISHED)
        pubres.storage_object.digest_modified = datetime.date(2012, 1, 1)
        pubres.storage_object.save()
예제 #34
0
 def setUp(self):
     """
     Import test fixtures and add resource pairs to TogetherManager
     """
     test_utils.setup_test_storage()
     test_utils.clean_stats()
     self.res_1 = _import_downloadable_resource('elra112.xml')
     self.res_2 = _import_downloadable_resource('elra135.xml')
     self.res_3 = _import_downloadable_resource('elra260.xml')
     self.res_4 = _import_downloadable_resource('elra295.xml')
     create_user('normaluser', '*****@*****.**', 'secret')
     create_user('normaluser2', '*****@*****.**', 'secret')
예제 #35
0
    def setUpClass(cls):
        """
        Set up the view
        """
        LOGGER.info("running '{}' tests...".format(cls.__name__))
        test_utils.setup_test_storage()

        # create an groups used to get the proper results
        Group.objects.create(name='ecmembers')
        Group.objects.create(name='elrcReviewers')

        cls.importPublishedFixtures()
예제 #36
0
파일: tests.py 프로젝트: MiltosD/CEFELRC
 def setUp(self):
     """
     Import test fixtures and add resource pairs to TogetherManager
     """
     test_utils.setup_test_storage()
     test_utils.clean_stats()
     self.res_1 = _import_downloadable_resource('elra112.xml')
     self.res_2 = _import_downloadable_resource('elra135.xml')
     self.res_3 = _import_downloadable_resource('elra260.xml')
     self.res_4 = _import_downloadable_resource('elra295.xml')
     create_user('normaluser', '*****@*****.**', 'secret')
     create_user('normaluser2', '*****@*****.**', 'secret')
예제 #37
0
 def test_status_after_saving(self):
     
     # load test fixture and set its status to 'published'
     test_utils.setup_test_storage()
     _result = test_utils.import_xml(TESTFIXTURE_XML)
     resource = resourceInfoType_model.objects.get(pk=_result[0].id)
     resource.editor_groups.add(self.test_editor_group)
     resource.storage_object.published = True
     # this also saves the storage object:
     resource.save()
 
     driver = self.driver
     driver.get(self.base_url)
     # login user
     login_user(driver, "manageruser", "secret")
     # make sure login was successful
     self.assertEqual("Logout", driver.find_element_by_xpath("//div[@id='inner']/div[2]/a[3]/div").text)
     # go to Editor
     driver.find_element_by_css_selector("div.button.middle_button").click()
     # go to Update->Resource
     mouse_over(driver, driver.find_element_by_link_text("Update"))
     #driver.find_element_by_link_text("Resource").click()        
     click_menu_item(driver, driver.find_element_by_link_text("Resource"))
     # make sure we are on the right site
     self.assertEqual("Select Resource to change | META-SHARE backend", driver.title)
     # check if LR entry is available and that its status is published
     try: 
         self.assertEqual("REVEAL-THIS Corpus",
             driver.find_element_by_link_text("REVEAL-THIS Corpus").text)
     except AssertionError as e: 
         self.verification_errors.append(str(e))
     try: 
         self.assertEqual(
           "published", 
           driver.find_element_by_xpath("//table[@id='result_list']/tbody/tr/td[3]").text)
     except AssertionError as e: 
         self.verification_errors.append(str(e))
     # click LR to edit it
     driver.find_element_by_link_text("REVEAL-THIS Corpus").click()
     # change the short name and save the LR
     driver.find_element_by_name("key_form-0-resourceShortName_0").clear()
     driver.find_element_by_name("key_form-0-resourceShortName_0").send_keys("en")
     driver.find_element_by_name("val_form-0-resourceShortName_0").clear()
     driver.find_element_by_name("val_form-0-resourceShortName_0").send_keys("a random short name")
     driver.find_element_by_name("_save").click()
     # make sure that the LR status is still published after saving
     try: 
         self.assertEqual(
           "published", 
           driver.find_element_by_xpath("//table[@id='result_list']/tbody/tr/td[3]").text)
     except AssertionError as e: 
         self.verification_errors.append(str(e))
예제 #38
0
 def setUp(self):
     """
     Import test fixtures and add resource pairs to TogetherManager
     """
     test_utils.setup_test_storage()
     self.res_1 = _import_resource('elra112.xml')
     self.res_2 = _import_resource('elra135.xml')
     self.res_3 = _import_resource('elra260.xml')
     self.res_4 = _import_resource('elra295.xml')
     self.max_view_interval_backup = settings.MAX_VIEW_INTERVAL
     settings.MAX_VIEW_INTERVAL = 5
     self.max_download_interval_backup = settings.MAX_DOWNLOAD_INTERVAL
     settings.MAX_DOWNLOAD_INTERVAL = 10
예제 #39
0
파일: tests.py 프로젝트: marc1s/META-SHARE
 def setUp(self):
     """
     Creates a new storage object instance for testing.
     """
     test_utils.setup_test_storage()
     folder = '{0}/storage/test_fixtures/updatetest'.format(settings.ROOT_PATH)
     with open('{0}/storage-global.json'.format(folder), 'rb') as storagein:
         self.storage_json = json.load(storagein)
     with open('{0}/metadata-before.xml'.format(folder), 'rb') as metadatain:
         self.metadata_before = metadatain.read()
     with open('{0}/metadata-modified.xml'.format(folder), 'rb') as metadatain:
         self.metadata_modified = metadatain.read()
     self.storage_id = self.storage_json['identifier']
예제 #40
0
 def setUpClass(cls):
     """
     Set up the view
     """
     test_utils.setup_test_storage()                        
  
     staffuser = create_user('staffuser', '*****@*****.**', 'secret')
     staffuser.is_staff = True
     staffuser.save()
     create_user('normaluser', '*****@*****.**', 'secret')
     # Make sure the index does not contain any stale entries:
     call_command('rebuild_index', interactive=False, using=settings.TEST_MODE_NAME)
     cls.importPublishedFixtures()
예제 #41
0
파일: tests.py 프로젝트: MiltosD/CEFELRC
 def setUp(self):
     """
     Import test fixtures and add resource pairs to TogetherManager
     """
     test_utils.setup_test_storage()
     self.res_1 = _import_resource('elra112.xml')
     self.res_2 = _import_resource('elra135.xml')
     self.res_3 = _import_resource('elra260.xml')
     self.res_4 = _import_resource('elra295.xml')
     self.max_view_interval_backup = settings.MAX_VIEW_INTERVAL
     settings.MAX_VIEW_INTERVAL = 5
     self.max_download_interval_backup = settings.MAX_DOWNLOAD_INTERVAL
     settings.MAX_DOWNLOAD_INTERVAL = 10
예제 #42
0
파일: test_view.py 프로젝트: hpusset/ELRI
    def setUpClass(cls):
        """
        Set up the test
        """
        LOGGER.info("running '{}' tests...".format(cls.__name__))

        # disable indexing during import
        test_utils.set_index_active(False)

        # import resources
        test_utils.setup_test_storage()
        OBJECT_XML_CACHE.clear()
        test_utils.import_xml_or_zip("{}/repository/fixtures/full-resources/"
                "partial-corpus.xml".format(ROOT_PATH))
예제 #43
0
 def setUp(self):
     """
     Sets up some resources with which to test.
     """
     test_utils.setup_test_storage()
     # set up different test resources
     self.non_downloadable_resource = _import_resource('ILSP10.xml')
     self.downloadable_resource_1 = \
         _import_resource('downloadable_1_license.xml')
     self.downloadable_resource_3 = \
         _import_resource('downloadable_3_licenses.xml')
     self.ms_commons_resource = \
         _import_resource('downloadable_ms_commons_license.xml')
     self.local_download_resource = \
         _import_resource('local_download.xml')
     # assign and copy downloadable resource
     self.local_download_resource.storage_object.checksum = \
         '3930f5022aff02c7fa27ffabf2eaaba0'
     self.local_download_resource.storage_object.save()
     self.local_download_resource.storage_object.update_storage()
     shutil.copyfile(
         '{0}/repository/fixtures/archive.zip'.format(settings.ROOT_PATH),
         '{0}/{1}/archive.zip'.format(
             settings.STORAGE_PATH,
             self.local_download_resource.storage_object.identifier))
     # set up test users with/without staff permissions and with/without
     # META-SHARE full membership
     staffuser = create_user('staffuser', '*****@*****.**', 'secret')
     staffuser.is_staff = True
     staffuser.save()
     create_user('normaluser', '*****@*****.**', 'secret')
     profile_ct = ContentType.objects.get_for_model(UserProfile)
     ms_full_member_perm = Permission.objects.get(content_type=profile_ct,
                                                  codename='ms_full_member')
     ms_member = create_user('fullmember', '*****@*****.**', 'secret')
     ms_member.user_permissions.add(ms_full_member_perm)
     ms_member.save()
     ms_member = create_user('associatemember', '*****@*****.**', 'secret')
     ms_member.user_permissions.add(
         Permission.objects.get(content_type=profile_ct,
                                codename='ms_associate_member'))
     ms_member.save()
     # create a test organization with META-SHARE full membership
     test_organization_ms = Organization.objects.create(
         name='test_organization_ms')
     test_organization_ms.permissions.add(ms_full_member_perm)
     test_organization_ms.save()
     test_utils.create_organization_member('organization_member_ms',
                                           '*****@*****.**', 'secret',
                                           (test_organization_ms, ))
예제 #44
0
 def setUp(self):
     """
     Set up the detail view
     """
     test_utils.setup_test_storage()
     self.resource = _import_resource('testfixture.xml')
     # 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.
     staffuser = create_user('staffuser', '*****@*****.**', 'secret')
     staffuser.is_staff = True
     staffuser.save()
     create_user('normaluser', '*****@*****.**', 'secret')
예제 #45
0
    def setUp(self):
        """
        Import test fixtures and add resource pairs to TogetherManager
        """
        test_utils.setup_test_storage()
        self.res_1 = _import_resource('creators-projects-1.xml')
        self.res_2 = _import_resource('creators-projects-2.xml')
        self.res_3 = _import_resource('creators-projects-3.xml')
        self.res_4 = _import_resource('creators-projects-4.xml')
        update_index.Command().handle(using=[settings.TEST_MODE_NAME,])

        # create an groups used to get the proper results
        Group.objects.create(name='ecmembers')
        Group.objects.create(name='reviewers')
예제 #46
0
 def setUp(self):
     test_utils.setup_test_storage()
     
     # text corpus
     self.testres1 = import_test_resource('testfixture.xml', PUBLISHED)
     # text corpus
     self.ing_testres = import_test_resource('completiontestfixture.xml', INGESTED)
     # lexical conceptual resource
     self.testres3 = import_test_resource('roundtrip.xml', PUBLISHED)
     # text corpus
     self.del_testres = import_test_resource('ILSP10.xml', PUBLISHED, True)
     # text, video, audio, textNumerical corpus
     self.testres5 = import_test_resource('ILSP11.xml', PUBLISHED)
     # tool/service
     self.testres6 = import_test_resource('local_download.xml', PUBLISHED)
예제 #47
0
    def setUp(self):
        """
        Set up the view
        """
        test_utils.setup_test_storage()
        clear_index.Command().handle(interactive=False,
                                     using=[
                                         settings.TEST_MODE_NAME,
                                     ])
        normaluser = create_user('normaluser', '*****@*****.**', 'secret')
        normaluser.save()

        # create an groups used to get the proper results
        Group.objects.create(name='ecmembers')
        Group.objects.create(name='elrcReviewers')
예제 #48
0
 def setUp(self):
     # make sure the index does not contain any stale entries
     call_command('rebuild_index', interactive=False, using=settings.TEST_MODE_NAME)
     # load test fixture; status will be set 'published'
     test_utils.setup_test_storage()
     import_dir(TESTFIXTURE_XML)
     
     # 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 = []
예제 #49
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),))
예제 #50
0
파일: test_view.py 프로젝트: hpusset/ELRI
 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),))
예제 #51
0
 def setUp(self):
     """
     Sets up some resources with which to test.
     """
     test_utils.setup_test_storage()
     # set up different test resources
     self.non_downloadable_resource = _import_resource('ILSP10.xml')
     self.downloadable_resource_1 = \
         _import_resource('downloadable_1_license.xml')
     self.downloadable_resource_3 = \
         _import_resource('downloadable_3_licenses.xml')
     self.ms_commons_resource = \
         _import_resource('downloadable_ms_commons_license.xml')
     self.local_download_resource = \
         _import_resource('local_download.xml')
     # assign and copy downloadable resource
     self.local_download_resource.storage_object.checksum = \
         '3930f5022aff02c7fa27ffabf2eaaba0'
     self.local_download_resource.storage_object.save()
     self.local_download_resource.storage_object.update_storage()
     shutil.copyfile(
       '{0}/repository/fixtures/archive.zip'.format(settings.ROOT_PATH),
       '{0}/{1}/archive.zip'.format(
         settings.STORAGE_PATH, self.local_download_resource.storage_object.identifier))
     # set up test users with/without staff permissions and with/without
     # META-SHARE full membership
     staffuser = create_user('staffuser', '*****@*****.**', 'secret')
     staffuser.is_staff = True
     staffuser.save()
     create_user('normaluser', '*****@*****.**', 'secret')
     profile_ct = ContentType.objects.get_for_model(UserProfile)
     ms_full_member_perm = Permission.objects.get(content_type=profile_ct,
                                                  codename='ms_full_member')
     ms_member = create_user('fullmember', '*****@*****.**', 'secret')
     ms_member.user_permissions.add(ms_full_member_perm)
     ms_member.save()
     ms_member = create_user('associatemember', '*****@*****.**', 'secret')
     ms_member.user_permissions.add(Permission.objects.get(
                 content_type=profile_ct, codename='ms_associate_member'))
     ms_member.save()
     # create a test organization with META-SHARE full membership
     test_organization_ms = Organization.objects.create(
                                                 name='test_organization_ms')
     test_organization_ms.permissions.add(ms_full_member_perm)
     test_organization_ms.save()
     test_utils.create_organization_member('organization_member_ms',
         '*****@*****.**', 'secret', (test_organization_ms,))
예제 #52
0
파일: test_view.py 프로젝트: ljo/META-SHARE
 def setUp(self):
     """
     Sets up some resources with which to test.
     """
     test_utils.setup_test_storage()
     # set up different test resources
     self.non_downloadable_resource_id = _import_resource('testfixture.xml')
     self.downloadable_resource_id_1 = \
         _import_resource('downloadable_1_license.xml')
     self.downloadable_resource_id_2 = \
         _import_resource('downloadable_3_licenses.xml')
     # set up test users with and without staff permissions
     staffuser = User.objects.create_user('staffuser', '*****@*****.**',
                                          'secret')
     staffuser.is_staff = True
     staffuser.save()
     User.objects.create_user('normaluser', '*****@*****.**', 'secret')
예제 #53
0
파일: tests.py 프로젝트: MiltosD/ELRC2
 def setUp(self):
     """
     Creates a new storage object instance for testing.
     """
     test_utils.setup_test_storage()
     folder = '{0}/storage/test_fixtures/updatetest'.format(
         settings.ROOT_PATH)
     with open('{0}/storage-global.json'.format(folder), 'rb') as storagein:
         self.storage_json = json.load(storagein)
     with open('{0}/metadata-before.xml'.format(folder),
               'rb') as metadatain:
         self.metadata_before = metadatain.read()
     with open('{0}/metadata-modified.xml'.format(folder),
               'rb') as metadatain:
         self.metadata_modified = metadatain.read()
     self.storage_id = self.storage_json['identifier']
     self.storage_digest = None
예제 #54
0
    def setUp(self):
        """
        Set up the test
        """
        # disable indexing during import
        test_utils.set_index_active(False)
        
        # import resources
        test_utils.setup_test_storage()
        OBJECT_XML_CACHE.clear()
        test_utils.import_xml_or_zip(RESOURCES_ZIP_FILE)

        # enable indexing 
        test_utils.set_index_active(True)
    
        # update index
        rebuild_index.Command().handle()
예제 #55
0
    def setUpClass(cls):
        """
        Set up the test
        """
        LOGGER.info("running '{}' tests...".format(cls.__name__))

        # disable indexing during import
        test_utils.set_index_active(False)

        # import resources
        test_utils.setup_test_storage()
        OBJECT_XML_CACHE.clear()
        test_utils.import_xml_or_zip("{}/repository/fixtures/full-resources/"
                                     "partial-corpus.xml".format(ROOT_PATH))
        test_utils.import_xml_or_zip(
            "{}/repository/fixtures/full-resources/"
            "full-lang-description.xml".format(ROOT_PATH))
        test_utils.import_xml_or_zip(
            "{}/repository/fixtures/full-resources/"
            "full-lex-conceptual.xml".format(ROOT_PATH))
        test_utils.import_xml_or_zip("{}/repository/fixtures/full-resources/"
                                     "full-corpus-text.xml".format(ROOT_PATH))
        test_utils.import_xml_or_zip("{}/repository/fixtures/full-resources/"
                                     "full-corpus-image.xml".format(ROOT_PATH))
        test_utils.import_xml_or_zip("{}/repository/fixtures/full-resources/"
                                     "full-corpus-audio.xml".format(ROOT_PATH))
        test_utils.import_xml_or_zip("{}/repository/fixtures/full-resources/"
                                     "full-corpus-video.xml".format(ROOT_PATH))
        test_utils.import_xml_or_zip(
            "{}/repository/fixtures/full-resources/"
            "full-corpus-textngram.xml".format(ROOT_PATH))
        test_utils.import_xml_or_zip(
            "{}/repository/fixtures/full-resources/"
            "full-corpus-textnumerical.xml".format(ROOT_PATH))
        test_utils.import_xml_or_zip("{}/repository/fixtures/full-resources/"
                                     "full-tool-service.xml".format(ROOT_PATH))

        # enable indexing
        test_utils.set_index_active(True)

        # update index
        from django.core.management import call_command
        call_command('rebuild_index', interactive=False, using=TEST_MODE_NAME)
예제 #56
0
    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
예제 #57
0
 def setUp(self):
     """
     Set up the view
     """
     test_utils.setup_test_storage()
     _fixture = '{0}/repo2/fixtures/testfixture.xml'.format(ROOT_PATH)
     _result = test_utils.import_xml(_fixture)
     self.resource_id = _result[0].id
     resource = resourceInfoType_model.objects.get(pk=self.resource_id)
     self.resource_name = getattr(resource.identificationInfo, 'resourceName', None)
     # 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.
     staffuser = User.objects.create_user('staffuser', '*****@*****.**',
       'secret')
     staffuser.is_staff = True
     staffuser.save()
     User.objects.create_user('normaluser', '*****@*****.**', 'secret')
예제 #58
0
    def setUpClass(cls):
        """
        Set up the test
        """
        LOGGER.info("running '{}' tests...".format(cls.__name__))

        # disable indexing during import
        test_utils.set_index_active(False)

        # import resources
        test_utils.setup_test_storage()
        OBJECT_XML_CACHE.clear()
        test_utils.import_xml_or_zip(RESOURCES_ZIP_FILE)

        # enable indexing
        test_utils.set_index_active(True)

        # update index
        from django.core.management import call_command
        call_command('rebuild_index', interactive=False, using=TEST_MODE_NAME)
예제 #59
0
    def setUp(self):

        test_utils.setup_test_storage()
        _fixture = '{0}/repository/fixtures/testfixture.xml'.format(ROOT_PATH)
        _result = test_utils.import_xml(_fixture)
        self.resource_id = _result.id
        resource = resourceInfoType_model.objects.get(pk=self.resource_id)
        resource.storage_object.published = True
        resource.storage_object.save()
        # 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.
        staffuser = User.objects.create_user('staffuser', '*****@*****.**',
                                             'secret')
        staffuser.is_staff = True
        staffuser.save()
        User.objects.create_user('normaluser', '*****@*****.**', 'secret')

        super(ExampleSeleniumTest, self).setUp()
        self.base_url = '{0}/{1}'.format(DJANGO_URL, DJANGO_BASE)