Skip to content

Commit

Permalink
further refactors tests
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangFahl committed Sep 27, 2024
1 parent c95e8bf commit ae8265a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
8 changes: 8 additions & 0 deletions tests/base_wiki_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from tests.base_test_config import WikiConfig
from tests.basetest import BaseTest
from wikibot3rd.wikibot import WikiBot
from wikibot3rd.wikiuser import WikiUser


Expand Down Expand Up @@ -58,3 +59,10 @@ def getSMW_WikiUser(self, wikiId="or", save=False) -> WikiUser:
else:
wikiUser = WikiUser.ofWikiId(wikiId, lenient=True)
return wikiUser

def getSMW_Wiki(self, wikiId="smw"):
wikiUser = self.getSMW_WikiUser(wikiId)
wikibot = None
if wikiUser is not None:
wikibot = WikiBot.ofWikiUser(wikiUser)
return wikibot
6 changes: 3 additions & 3 deletions tests/test_non_smw.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

import unittest

from tests.basetest import BaseTest
from tests.base_wiki_test import BaseWikiTest
from wikibot3rd.wikiclient import WikiClient
from wikibot3rd.wikipush import WikiPush


class TestNonSMW(BaseTest):
class TestNonSMW(BaseWikiTest):
"""
Test functionality for non SemanticMediaWiki sites
according to https://github.com/WolfgangFahl/py-3rdparty-mediawiki/issues/104
Expand All @@ -20,7 +20,7 @@ class TestNonSMW(BaseTest):
"""

def setUp(self, debug=False, profile=True):
BaseTest.setUp(self, debug=debug, profile=profile)
BaseWikiTest.setUp(self, debug=debug, profile=profile)
self.wiki_id = "genealogy"
self.category = "Kategorie:Adressbuch_in_der_Online-Erfassung/fertig"

Expand Down
7 changes: 0 additions & 7 deletions tests/test_wikibot.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@ def testRandomCrypt(self):
self.assertEqual(32, len(cypher))
self.assertEqual(8, len(salt))

def getSMW_Wiki(self, wikiId="smw"):
wikiUser = self.getSMW_WikiUser(wikiId)
wikibot = None
if wikiUser is not None:
wikibot = WikiBot.ofWikiUser(wikiUser)
return wikibot

def testWikiBotNoLogin(self):
"""
test a wikibot3rd where no login is needed
Expand Down

0 comments on commit ae8265a

Please sign in to comment.