[MediaWiki-commits] [Gerrit] pywikibot/core[master]: [TEST] Add tests for flow.Topic class
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/405027 ) Change subject: [TEST] Add tests for flow.Topic class .. [TEST] Add tests for flow.Topic class Page https://test.wikipedia.org/wiki/User:Framawiki/pwb_tests/flow_board was created for these tests. Bug: T60941 Change-Id: Idfbae75bd8fd2bbd342a769504b44fd3e3c2ed16 --- M tests/flow_tests.py 1 file changed, 31 insertions(+), 0 deletions(-) Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved diff --git a/tests/flow_tests.py b/tests/flow_tests.py index dfc87f8..728db61 100644 --- a/tests/flow_tests.py +++ b/tests/flow_tests.py @@ -211,3 +211,34 @@ self.assertRaises(AssertionError, Post.fromJSON, real_topic, 'abc', {'posts': {'abc': ['123']}, 'revisions': {'123': {'content': 789}}}) + + +class TestFlowTopic(TestCase): +"""Test Topic functions.""" + +family = 'test' +code = 'test' + +def test_topic(self): +"""Test general functions of the Topic class.""" +topic = Topic(self.site, 'Topic:U5y4l1rzitlplyc5') +self.assertEqual(topic.root.uuid, 'u5y4l1rzitlplyc5') +replies = topic.replies() +self.assertEqual(len(replies), 3) +self.assertTrue(all(isinstance(reply, Post) +for reply in replies)) +self.assertEqual(replies[1].uuid, 'u5y5lysqcvyne4k1') + +def test_topic_moderation(self): +"""Test Topic functions about moderation.""" +topic_closed = Topic(self.site, 'Topic:U5y4efgaprfe7ssi') +self.assertTrue(topic_closed.is_locked) +self.assertTrue(topic_closed.is_moderated) + +topic_open = Topic(self.site, 'Topic:U5y4l1rzitlplyc5') +self.assertFalse(topic_open.is_locked) +self.assertFalse(topic_open.is_moderated) + +topic_hidden = Topic(self.site, 'Topic:U5y53rn0dp6h70nw') +self.assertFalse(topic_hidden.is_locked) +self.assertTrue(topic_hidden.is_moderated) -- To view, visit https://gerrit.wikimedia.org/r/405027 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Idfbae75bd8fd2bbd342a769504b44fd3e3c2ed16 Gerrit-PatchSet: 2 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Framawiki Gerrit-Reviewer: John Vandenberg Gerrit-Reviewer: Xqt Gerrit-Reviewer: Zoranzoki21 Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] pywikibot/core[master]: [TEST] Add tests for flow.Topic class
Framawiki has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405027 ) Change subject: [TEST] Add tests for flow.Topic class .. [TEST] Add tests for flow.Topic class Page https://test.wikipedia.org/wiki/User:Framawiki/pwb_tests/flow_board was created for these tests. Bug: T60941 Change-Id: Idfbae75bd8fd2bbd342a769504b44fd3e3c2ed16 --- M tests/flow_tests.py 1 file changed, 31 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/27/405027/1 diff --git a/tests/flow_tests.py b/tests/flow_tests.py index dfc87f8..99e762c 100644 --- a/tests/flow_tests.py +++ b/tests/flow_tests.py @@ -211,3 +211,34 @@ self.assertRaises(AssertionError, Post.fromJSON, real_topic, 'abc', {'posts': {'abc': ['123']}, 'revisions': {'123': {'content': 789}}}) + + +class TestFlowTopic(TestCase): +"""Test Topic functions""" + +family = 'test' +code = 'test' + +def test_topic(self): +"""Test general functions of the Topic class""" +topic = Topic(self.site, 'Topic:U5y4l1rzitlplyc5') +self.assertEqual(topic.root.uuid, 'u5y4l1rzitlplyc5') +replies = topic.replies() +self.assertEqual(len(replies), 3) +self.assertTrue(all(isinstance(reply, Post) +for reply in replies)) +self.assertEqual(replies[1].uuid, 'u5y5lysqcvyne4k1') + +def test_topic_moderation(self): +"""Test Topic functions about moderation""" +topic_closed = Topic(self.site, 'Topic:U5y4efgaprfe7ssi') +self.assertTrue(topic_closed.is_locked) +self.assertTrue(topic_closed.is_moderated) + +topic_open = Topic(self.site, 'Topic:U5y4l1rzitlplyc5') +self.assertFalse(topic_open.is_locked) +self.assertFalse(topic_open.is_moderated) + +topic_hidden = Topic(self.site, 'Topic:U5y53rn0dp6h70nw') +self.assertFalse(topic_hidden.is_locked) +self.assertTrue(topic_hidden.is_moderated) \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/405027 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idfbae75bd8fd2bbd342a769504b44fd3e3c2ed16 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Framawiki ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits