jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1025771?usp=email )

Change subject: [tests] move OAuthEditTest from edit_tests.py to oauth_tests.py
......................................................................

[tests] move OAuthEditTest from edit_tests.py to oauth_tests.py

Change-Id: I10a827744d7344114b03752b64ad34b510210477
---
M tests/edit_tests.py
M tests/oauth_tests.py
2 files changed, 42 insertions(+), 40 deletions(-)

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




diff --git a/tests/edit_tests.py b/tests/edit_tests.py
index 93e6cdb..415be0a 100755
--- a/tests/edit_tests.py
+++ b/tests/edit_tests.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 """Tests for editing pages."""
 #
-# (C) Pywikibot team, 2015-2022
+# (C) Pywikibot team, 2015-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -12,10 +12,9 @@
 from contextlib import suppress

 import pywikibot
-from pywikibot import config, page_put_queue
+from pywikibot import page_put_queue
 from pywikibot.exceptions import Error
 from tests.aspects import TestCase, require_version
-from tests.oauth_tests import OAuthSiteTestCase


 called_back = False
@@ -176,42 +175,6 @@
         self.assertEqual(dest.revision_count(), 2)


-class OAuthEditTest(OAuthSiteTestCase):
-
-    """Run edit test with OAuth enabled."""
-
-    family = 'wikipedia'
-    code = 'test'
-
-    write = True
-
-    def setUp(self):
-        """Set up test by checking site and initialization."""
-        super().setUp()
-        self._authenticate = config.authenticate
-        oauth_tokens = self.consumer_token + self.access_token
-        config.authenticate[self.site.hostname()] = oauth_tokens
-
-    def tearDown(self):
-        """Tear down test by resetting config.authenticate."""
-        super().tearDown()
-        config.authenticate = self._authenticate
-
-    def test_edit(self):
-        """Test editing to a page."""
-        self.site.login()
-        self.assertTrue(self.site.logged_in())
-        ts = str(time.time())
-        p = pywikibot.Page(self.site,
-                           f'User:{self.site.username()}/edit test')
-        p.site.editpage(p, appendtext=ts)
-        revision_id = p.latest_revision_id
-        p = pywikibot.Page(self.site,
-                           f'User:{self.site.username()}/edit test')
-        self.assertEqual(revision_id, p.latest_revision_id)
-        self.assertTrue(p.text.endswith(ts))
-
-
 if __name__ == '__main__':
     with suppress(SystemExit):
         unittest.main()
diff --git a/tests/oauth_tests.py b/tests/oauth_tests.py
index 345d4f3..836b91a 100755
--- a/tests/oauth_tests.py
+++ b/tests/oauth_tests.py
@@ -1,15 +1,18 @@
 #!/usr/bin/env python3
 """Test OAuth functionality."""
 #
-# (C) Pywikibot team, 2015-2023
+# (C) Pywikibot team, 2015-2024
 #
 # Distributed under the terms of the MIT license.
 #
 from __future__ import annotations

 import os
+import time
 from contextlib import suppress

+import pywikibot
+from pywikibot import config
 from pywikibot.login import OauthLoginManager
 from tests.aspects import (
     DefaultSiteTestCase,
@@ -46,6 +49,42 @@
         self.access_token = tokens[2:]


+class OAuthEditTest(OAuthSiteTestCase):
+
+    """Run edit test with OAuth enabled."""
+
+    family = 'wikipedia'
+    code = 'test'
+
+    write = True
+
+    def setUp(self):
+        """Set up test by checking site and initialization."""
+        super().setUp()
+        self._authenticate = config.authenticate
+        oauth_tokens = self.consumer_token + self.access_token
+        config.authenticate[self.site.hostname()] = oauth_tokens
+
+    def tearDown(self):
+        """Tear down test by resetting config.authenticate."""
+        super().tearDown()
+        config.authenticate = self._authenticate
+
+    def test_edit(self):
+        """Test editing to a page."""
+        self.site.login()
+        self.assertTrue(self.site.logged_in())
+        ts = str(time.time())
+        p = pywikibot.Page(self.site,
+                           f'User:{self.site.username()}/edit test')
+        p.site.editpage(p, appendtext=ts)
+        revision_id = p.latest_revision_id
+        p = pywikibot.Page(self.site,
+                           f'User:{self.site.username()}/edit test')
+        self.assertEqual(revision_id, p.latest_revision_id)
+        self.assertTrue(p.text.endswith(ts))
+
+
 class TestOauthLoginManger(DefaultSiteTestCase, OAuthSiteTestCase):

     """Test OAuth login manager."""

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1025771?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I10a827744d7344114b03752b64ad34b510210477
Gerrit-Change-Number: 1025771
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to