jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/539073 )

Change subject: [tests] rewrite TestUserList
......................................................................

[tests] rewrite TestUserList

- missing user names are also listed in Site.users
  but have a 'missing' key in that case

Change-Id: I59c75030878b37a0b2b0c7e359f32bee14b33b6d
---
M tests/site_tests.py
1 file changed, 10 insertions(+), 7 deletions(-)

Approvals:
  Dvorapa: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/site_tests.py b/tests/site_tests.py
index c55d232..3bbd784 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -2108,16 +2108,19 @@

     def test_users(self):
         """Test the site.users() method with preset usernames."""
-        mysite = self.site
+        user_list = ['Jimbo Wales', 'Brion VIBBER', 'Tim Starling']
+        missing = ['A username that should not exist 1A53F6E375B5']
+        all_users = user_list + missing
         cnt = 0
-        for user in mysite.users(
-                ['Jimbo Wales', 'Brion VIBBER', 'Tim Starling']):
+        for user in self.site.users(all_users):
             self.assertIsInstance(user, dict)
-            self.assertTrue(user['name']
-                            in ['Jimbo Wales', 'Brion VIBBER', 'Tim Starling'])
+            self.assertIn(user['name'], all_users)
+            if user['name'] == missing[0]:
+                self.assertIn('missing', user)
+            else:
+                self.assertNotIn('missing', user)
             cnt += 1
-        if not cnt:
-            self.skipTest('Test usernames not found')
+        self.assertEqual(cnt, len(all_users), 'Some test usernames not found')


 class PatrolTestCase(TokenTestBase, TestCase):

--
To view, visit https://gerrit.wikimedia.org/r/539073
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I59c75030878b37a0b2b0c7e359f32bee14b33b6d
Gerrit-Change-Number: 539073
Gerrit-PatchSet: 6
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Dvorapa <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot (75)
Gerrit-CC: Mpaa <[email protected]>
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to