jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1202653?usp=email )
Change subject: Tests: update tests after dropping deprecated code parts
......................................................................
Tests: update tests after dropping deprecated code parts
- remove SiteUserTestCase.test_deprecated_methods
- refactor TestSiteTokens
Bug: T396368
Change-Id: I5a78f9fb4ac1fc7bc4e726714ab75c8cc9ceb621
---
M tests/site_tests.py
M tests/token_tests.py
2 files changed, 6 insertions(+), 16 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 87a512a..f4dd61f 100755
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -340,12 +340,6 @@
'nosuchright'):
self.assertIsInstance(mysite.has_right(rgt), bool)
- def test_deprecated_methods(self) -> None:
- """Test deprecated user related methods."""
- mysite = self.get_site()
- self.assertIsInstance(mysite.messages(), bool)
- self.assertOneDeprecation()
-
def test_logevents(self) -> None:
"""Test the site.logevents() method."""
mysite = self.get_site()
diff --git a/tests/token_tests.py b/tests/token_tests.py
index f0eaaf0..7ec8786 100755
--- a/tests/token_tests.py
+++ b/tests/token_tests.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""Tests for tokens."""
#
-# (C) Pywikibot team, 2015-2024
+# (C) Pywikibot team, 2015-2025
#
# Distributed under the terms of the MIT license.
#
@@ -33,20 +33,16 @@
def test_tokens(self) -> None:
"""Test tokens."""
- redirected_tokens = ['edit', 'move', 'delete']
- for ttype in [*redirected_tokens, 'patrol', 'deleteglobalaccount']:
+ for ttype in 'patrol', 'deleteglobalaccount':
self.assertIsInstance(self.site.tokens[ttype], str)
self.assertIn(ttype, self.site.tokens) # test __contains__
- if ttype in redirected_tokens:
- self.assertEqual(self.site.tokens[ttype],
- self.site.tokens['csrf'])
- self._do_test_warning_filename = False
- self.assertDeprecationParts(f'Token {ttype!r}', "'csrf'")
def test_invalid_token(self) -> None:
"""Test invalid token."""
- with self.assertRaises(KeyError):
- self.site.tokens['invalidtype']
+ redirected_tokens = ['edit', 'move', 'delete']
+ for ttype in [*redirected_tokens, 'invalidtype']:
+ with self.assertRaises(KeyError):
+ self.site.tokens['invalidtype']
class TokenTestBase(TestCaseBase):
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1202653?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I5a78f9fb4ac1fc7bc4e726714ab75c8cc9ceb621
Gerrit-Change-Number: 1202653
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]