Skip to content

Commit

Permalink
Adiciona propriedade que define a exibição ou não do texto completo
Browse files Browse the repository at this point in the history
  • Loading branch information
Joffily Ferreira authored and joffilyfe committed May 19, 2020
1 parent 6cc4554 commit 9da08da
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions opac_schema/v1/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
32 changes: 32 additions & 0 deletions tests/test_article.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 9da08da

Please sign in to comment.