Пример #1
0
 def test_get_attempt_failure(self):
     """
     Attempt is already registered
     """
     self.assertIsInstance(checkin.get_attempt('samples/0042-9686-bwho-91-08-545.zip'),
         models.Attempt)
     self.assertRaises(excepts.DuplicatedPackage,
         lambda: checkin.get_attempt('samples/0042-9686-bwho-91-08-545.zip'))
Пример #2
0
 def test_get_attempt_failure(self):
     """
     Attempt is already registered
     """
     safe_package = doubles.SafePackageStub(SAMPLE_PACKAGE, '/tmp/')
     self.assertIsInstance(checkin.get_attempt(safe_package),
                           models.Attempt)
     self.assertRaises(excepts.DuplicatedPackage,
                       lambda: checkin.get_attempt(safe_package))
Пример #3
0
 def test_get_attempt_ok(self):
     """
     Attempt generates fine
     """
     safe_package = doubles.SafePackageStub(SAMPLE_PACKAGE, '/tmp/')
     self.assertIsInstance(checkin.get_attempt(safe_package),
                           models.Attempt)
Пример #4
0
 def test_get_attempt_invalid_package_missing_issn_and_article_title(self):
     """
     Package is invalid because there is no ISSN and article_title
     """
     pkg = self._make_test_archive([('texto.xml', b'<root/>')])
     safe_package = package.SafePackage(pkg.name, '/tmp/')
     self.assertRaises(ValueError,
                       lambda: checkin.get_attempt(safe_package))
Пример #5
0
 def test_accessing_generated_attempt_data(self):
     """
     Attempt generates fine
     """
     safe_package = doubles.SafePackageStub(SAMPLE_PACKAGE, '/tmp/')
     attempt = checkin.get_attempt(safe_package)
     # this filepath was got from doubles.PackageAnalyzerStub
     self.assertTrue('/tmp/bla.zip' in attempt.filepath)
Пример #6
0
    def test_get_attempt_article_title_is_already_registered(self):
        """
        There are more than one article registered with same article title
        """
        pkg = checkin.PackageAnalyzer('samples/0042-9686-bwho-91-08-545.zip')
        article = models.ArticlePkg(**pkg.meta)
        self.session.add(article)
        transaction.commit()

        article2 = models.ArticlePkg(**pkg.meta)
        article2.journal_title = 'REV'
        self.session.add(article2)
        transaction.commit()

        attempt = checkin.get_attempt('samples/0042-9686-bwho-91-08-545.zip')
        self.assertIsInstance(attempt, models.Attempt)
Пример #7
0
    def test_get_attempt_article_title_is_already_registered(self):
        """
        There are more than one article registered with same article title
        """
        pkg = package.PackageAnalyzer(SAMPLE_PACKAGE)
        article = models.ArticlePkg(**pkg.meta)
        self.session.add(article)
        transaction.commit()

        article2 = models.ArticlePkg(**pkg.meta)
        article2.journal_title = 'REV'
        self.session.add(article2)
        transaction.commit()

        safe_package = doubles.SafePackageStub(SAMPLE_PACKAGE, '/tmp/')
        attempt = checkin.get_attempt(safe_package)
        self.assertIsInstance(attempt, models.Attempt)
Пример #8
0
 def test_get_attempt_invalid_package_missing_issn_and_article_title(self):
     """
     Package is invalid because there is no ISSN and article_title
     """
     pkg = self._make_test_archive([('texto.xml', b'<root/>')])
     self.assertRaises(ValueError, lambda: checkin.get_attempt(pkg.name))
Пример #9
0
 def test_accessing_generated_attempt_data(self):
     """
     Attempt generates fine
     """
     attempt = checkin.get_attempt('samples/0042-9686-bwho-91-08-545.zip')
     self.assertTrue('0042-9686-bwho-91-08-545.zip' in attempt.filepath)
Пример #10
0
 def test_get_attempt_ok(self):
     """
     Attempt generates fine
     """
     self.assertIsInstance(checkin.get_attempt('samples/0042-9686-bwho-91-08-545.zip'),
         models.Attempt)