Example #1
0
    def test_check_article_legend_output(self):
        # given
        # create a journal
        journal_doc = self._create_dummy_journal()
        issue_doc = self._create_dummy_issue(journal_doc)

        _id = self.generate_uuid_32_string()
        aid = self.generate_uuid_32_string()
        article_data = {
            '_id': _id,
            'aid': aid,
            'is_public': True,
            # requerido pelo Legendarium:
            'journal': journal_doc,
            'issue': issue_doc,
        }

        # when
        article_doc = Article(**article_data)
        article_doc.save()

        # then
        expected_legend = u"%s, %s %s(%s)" % (journal_doc.short_title,
                                              issue_doc.year, issue_doc.volume,
                                              issue_doc.number)
        self.assertEqual(expected_legend, article_doc.legend)
Example #2
0
    def test_check_article_url_with_elocation(self):
        # given
        # create a journal
        journal_doc = self._create_dummy_journal()
        issue_doc = self._create_dummy_issue(journal_doc)

        _id = self.generate_uuid_32_string()
        aid = self.generate_uuid_32_string()
        article_data = {
            '_id': _id,
            'aid': aid,
            'is_public': True,
            # requerido pelo Legendarium:
            'journal': journal_doc,
            'issue': issue_doc,
            'fpage_sequence': 'FPAGE_SEQ',
            'fpage': 'FPAGE',
            'lpage': 'LPAGE',
            'elocation': 'ELOCATION',
            'doi': 'DOI',
            'order': 1111,
        }

        # when
        article_doc = Article(**article_data)
        article_doc.save()

        # then
        self.assertEqual('ELOCATION', article_doc.url)
Example #3
0
    def test_create_only_required_fields_with_valid_journal_success(self):
        # given
        # create a journal
        journal_doc = self._create_dummy_journal()
        issue_doc = self._create_dummy_issue(journal_doc)

        _id = self.generate_uuid_32_string()
        aid = self.generate_uuid_32_string()
        article_data = {
            '_id': _id,
            'aid': aid,
            'is_public': True,
            # requerido pelo Legendarium:
            'journal': journal_doc,
            'issue': issue_doc,
        }

        # when
        article_data = Article(**article_data)
        article_data.save()

        # then
        articles_count = Article.objects.all().count()
        self.assertEqual(_id, article_data._id)
        self.assertEqual(aid, article_data.aid)
        self.assertEqual(1, articles_count)
Example #4
0
    def test_check_article_legend_output(self):
        # given
        # create a journal
        journal_doc = self._create_dummy_journal()
        issue_doc = self._create_dummy_issue(journal_doc)

        _id = self.generate_uuid_32_string()
        aid = self.generate_uuid_32_string()
        article_data = {
            '_id': _id,
            'aid': aid,
            'is_public': True,
            # requerido pelo Legendarium:
            'journal': journal_doc,
            'issue': issue_doc,
        }

        # when
        article_doc = Article(**article_data)
        article_doc.save()

        # then
        expected_legend = u"%s, %s %s(%s)" % (
            journal_doc.short_title, issue_doc.year,
            issue_doc.volume, issue_doc.number)
        self.assertEqual(expected_legend, article_doc.legend)
Example #5
0
    def test_create_only_required_fields_with_valid_journal_success(self):
        # given
        # create a journal
        journal_doc = self._create_dummy_journal()
        issue_doc = self._create_dummy_issue(journal_doc)

        _id = self.generate_uuid_32_string()
        aid = self.generate_uuid_32_string()
        article_data = {
            '_id': _id,
            'aid': aid,
            'is_public': True,
            # requerido pelo Legendarium:
            'journal': journal_doc,
            'issue': issue_doc,
        }

        # when
        article_data = Article(**article_data)
        article_data.save()

        # then
        articles_count = Article.objects.all().count()
        self.assertEqual(_id, article_data._id)
        self.assertEqual(aid, article_data.aid)
        self.assertEqual(1, articles_count)
Example #6
0
    def test_check_article_pid_already_set(self):
        # given
        # create a journal
        journal_doc = self._create_dummy_journal()
        issue_doc = self._create_dummy_issue(journal_doc)

        _id = self.generate_uuid_32_string()
        aid = self.generate_uuid_32_string()
        article_data = {
            '_id': _id,
            'aid': aid,
            'is_public': True,
            # requerido pelo Legendarium:
            'journal': journal_doc,
            'issue': issue_doc,
            'order': 1111,
            'pid': "S0101-02022019000300123",
            'scielo_pids': {
                "v1": "S0101-0202(98)01100123",
                "v2": "S0101-02022019000300001",
                "v3": "azEglOE290cWcmloijsd",
            },
        }

        # when
        article_doc = Article(**article_data)
        article_doc.save()

        # then
        self.assertEqual(article_doc.pid, "S0101-02022019000300123")
Example #7
0
    def test_check_article_url_with_order(self):
        # given
        # create a journal
        journal_doc = self._create_dummy_journal()
        issue_doc = self._create_dummy_issue(journal_doc)

        _id = self.generate_uuid_32_string()
        aid = self.generate_uuid_32_string()
        article_data = {
            '_id': _id,
            'aid': aid,
            'is_public': True,
            # requerido pelo Legendarium:
            'journal': journal_doc,
            'issue': issue_doc,
            'order': 1111,
        }

        # when
        article_doc = Article(**article_data)
        article_doc.save()

        # then
        self.assertEqual('o1111', article_doc.url)