コード例 #1
0
    def test_match_based_on_electronic_issn(self):
        article = modelfactories.ArticleFactory.create()
        article.issn_ppub = ''
        article.issn_epub = '1518-8787'
        article.save()

        journal = modelfactories.JournalFactory.create(eletronic_issn='1518-8787')

        tasks.link_article_to_journal(article.pk)

        fresh_article = models.Article.objects.get(pk=article.pk)
        self.assertEquals(fresh_article.journal.pk, journal.pk)
コード例 #2
0
    def test_match_based_on_print_issn(self):
        article = modelfactories.ArticleFactory.create()
        article.issn_epub = ''
        article.issn_ppub = '1518-8787'
        article.save()

        journal = modelfactories.JournalFactory.create(print_issn='1518-8787')

        tasks.link_article_to_journal(article.pk)

        fresh_article = models.Article.objects.get(pk=article.pk)
        self.assertEquals(fresh_article.journal.pk, journal.pk)
コード例 #3
0
    def test_match_based_on_crossed_print_issn(self):
        """Quando issn_ppub está identificado como issn_epub
        """
        article = modelfactories.ArticleFactory.create()
        article.issn_ppub = ''
        article.issn_epub = '1518-8787'
        article.save()

        journal = modelfactories.JournalFactory.create(print_issn='1518-8787')

        tasks.link_article_to_journal(article.pk)

        fresh_article = models.Article.objects.get(pk=article.pk)
        self.assertEquals(fresh_article.journal.pk, journal.pk)
コード例 #4
0
    def test_match_based_on_crossed_electronic_issn(self):
        """Quando issn_epub está identificado como issn_ppub
        """
        article = modelfactories.ArticleFactory.create()
        article.issn_epub = ''
        article.issn_ppub = '1518-8787'
        article.save()

        journal = modelfactories.JournalFactory.create(
            eletronic_issn='1518-8787')

        tasks.link_article_to_journal(article.pk)

        fresh_article = models.Article.objects.get(pk=article.pk)
        self.assertEquals(fresh_article.journal.pk, journal.pk)
コード例 #5
0
    def test_many_journals_without_electronic_issn(self):
        article = modelfactories.ArticleFactory.create()
        article.issn_epub = ''
        article.issn_ppub = '1518-8787'
        article.save()

        for _ in range(2):
            journal = modelfactories.JournalFactory.create(eletronic_issn='')
            # o valor de `print_issn` deve ser diferente para o teste ser
            # válido
            self.assertTrue(journal.print_issn != article.issn_ppub)

        tasks.link_article_to_journal(article.pk)

        fresh_article = models.Article.objects.get(pk=article.pk)
        # não houve match.
        self.assertEquals(fresh_article.journal, None)
コード例 #6
0
    def test_many_journals_without_electronic_issn(self):
        article = modelfactories.ArticleFactory.create()
        article.issn_epub = ''
        article.issn_ppub = '1518-8787'
        article.save()

        for _ in range(2):
            journal = modelfactories.JournalFactory.create(eletronic_issn='')
            # o valor de `print_issn` deve ser diferente para o teste ser
            # válido
            self.assertTrue(journal.print_issn != article.issn_ppub)

        tasks.link_article_to_journal(article.pk)

        fresh_article = models.Article.objects.get(pk=article.pk)
        # não houve match.
        self.assertEquals(fresh_article.journal, None)