jenkins-bot merged this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[TEST] fix test_login_logout, OAuth case

Bug: T222508
Change-Id: I5822de7ab5169fed3e9819d3ad61a37bca580030
---
M tests/site_tests.py
1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/tests/site_tests.py b/tests/site_tests.py
index 8d3f40e..0e012c4 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -3723,13 +3723,23 @@

self.assertIsNone(site.login())

- site.logout()
- self.assertFalse(site.logged_in())
- self.assertEqual(site._loginstatus, loginstatus.NOT_LOGGED_IN)
- self.assertNotIn('_userinfo', site.__dict__.keys())
+ if site.is_oauth_token_available():
+ self.assertRaisesRegexp(api.APIError, 'cannotlogout.*OAuth',
+ site.logout)
+ self.assertTrue(site.logged_in())
+ self.assertIn(site._loginstatus, (loginstatus.IN_PROGRESS,
+ loginstatus.AS_USER))
+ self.assertIn('_userinfo', site.__dict__.keys())

- self.assertRaisesRegexp(AssertionError,
- 'User must login in this site', site.logout)
+ else:
+ site.logout()
+ self.assertFalse(site.logged_in())
+ self.assertEqual(site._loginstatus, loginstatus.NOT_LOGGED_IN)
+ self.assertNotIn('_userinfo', site.__dict__.keys())
+
+ self.assertRaisesRegexp(AssertionError,
+ 'User must login in this site',
+ site.logout)


if __name__ == '__main__': # pragma: no cover

To view, visit change 508111. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I5822de7ab5169fed3e9819d3ad61a37bca580030
Gerrit-Change-Number: 508111
Gerrit-PatchSet: 1
Gerrit-Owner: Framawiki <framawiki@tools.wmflabs.org>
Gerrit-Reviewer: Dvorapa <dvorapa@seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot (75)