From 9da08dafce93931c747345fc42f210f00d7d835c Mon Sep 17 00:00:00 2001 From: Joffily Ferreira Date: Mon, 18 May 2020 16:19:27 -0300 Subject: [PATCH] =?UTF-8?q?Adiciona=20propriedade=20que=20define=20a=20exi?= =?UTF-8?q?bi=C3=A7=C3=A3o=20ou=20n=C3=A3o=20do=20texto=20completo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- opac_schema/v1/models.py | 1 + tests/test_article.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/opac_schema/v1/models.py b/opac_schema/v1/models.py index 22a7b63..dfd08a5 100644 --- a/opac_schema/v1/models.py +++ b/opac_schema/v1/models.py @@ -621,6 +621,7 @@ class Article(Document): url_segment = StringField() aop_url_segs = EmbeddedDocumentField(AOPUrlSegments) scielo_pids = DictField() + display_full_text = BooleanField(required=True, default=True) meta = { 'collection': 'article', diff --git a/tests/test_article.py b/tests/test_article.py index 4e0d3c3..784f09a 100644 --- a/tests/test_article.py +++ b/tests/test_article.py @@ -330,3 +330,35 @@ def test_check_article_pid_already_set(self): # then self.assertEqual(article_doc.pid, "S0101-02022019000300123") + def test_if_display_full_text_is_true_by_default(self): + journal_doc = self._create_dummy_journal() + issue_doc = self._create_dummy_issue(journal_doc) + article_data = { + '_id': self.generate_uuid_32_string(), + 'aid': self.generate_uuid_32_string(), + 'is_public': True, + 'journal': journal_doc, + 'issue': issue_doc, + 'order': 1111, + 'pid': "S0101-02022019000300123" + } + article_doc = Article(**article_data) + article_doc.save() + self.assertTrue(article_doc.display_full_text) + + def test_if_display_full_text_could_be_setted_as_false(self): + journal_doc = self._create_dummy_journal() + issue_doc = self._create_dummy_issue(journal_doc) + article_data = { + '_id': self.generate_uuid_32_string(), + 'aid': self.generate_uuid_32_string(), + 'is_public': True, + 'journal': journal_doc, + 'issue': issue_doc, + 'order': 1111, + 'pid': "S0101-02022019000300123", + 'display_full_text': False + } + article_doc = Article(**article_data) + article_doc.save() + self.assertFalse(article_doc.display_full_text) \ No newline at end of file