mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-22 00:14:10 +00:00
Added migration test, fixes in previous tests
This commit is contained in:
parent
5d48533e69
commit
9196a9cbbe
|
@ -23,11 +23,12 @@ global settings
|
|||
def load_settings():
|
||||
global settings
|
||||
try: # load settings
|
||||
command_args.settings.seek(0)
|
||||
settings = json.load(command_args.settings)
|
||||
if settings["limitrefetch"] < settings["limit"] and settings["limitrefetch"] != -1:
|
||||
settings["limitrefetch"] = settings["limit"]
|
||||
if "user-agent" in settings["header"]:
|
||||
settings["header"]["user-agent"] = settings["header"]["user-agent"].format(version="1.14.0.2") # set the version in the useragent
|
||||
settings["header"]["user-agent"] = settings["header"]["user-agent"].format(version="1.14.1") # set the version in the useragent
|
||||
except FileNotFoundError:
|
||||
logging.critical("No config file could be found. Please make sure settings.json is in the directory.")
|
||||
sys.exit(1)
|
||||
|
|
|
@ -341,6 +341,7 @@ if TESTING:
|
|||
day_overview()
|
||||
import src.discussions
|
||||
src.discussions.fetch_discussions()
|
||||
logger.info("Test has succeeded without premature exceptions.")
|
||||
sys.exit(0)
|
||||
|
||||
while 1:
|
||||
|
|
|
@ -38,6 +38,7 @@ storage = datafile
|
|||
|
||||
logger = logging.getLogger("rcgcdw.rc")
|
||||
|
||||
|
||||
class Wiki(object):
|
||||
"""Store verious data and functions related to wiki and fetching of Recent Changes"""
|
||||
def __init__(self, rc_processor: Callable, abuse_processor: Callable):
|
||||
|
@ -394,8 +395,7 @@ class Wiki(object):
|
|||
if self.downtimecredibility < 60:
|
||||
self.downtimecredibility += 15
|
||||
else:
|
||||
if (
|
||||
time.time() - self.last_downtime) > 1800 and self.check_connection(): # check if last downtime happened within 30 minutes, if yes, don't send a message
|
||||
if (time.time() - self.last_downtime) > 1800 and self.check_connection(): # check if last downtime happened within 30 minutes, if yes, don't send a message
|
||||
send_simple("down_detector", _("{wiki} seems to be down or unreachable.").format(wiki=settings["wikiname"]),
|
||||
_("Connection status"), settings["avatars"]["connection_failed"])
|
||||
self.last_downtime = time.time()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"edit": {"allowed_mentions": {"parse": []}, "avatar_url": "", "embeds": [{"color": 16711680, "url": "https://minecraft.fandom.com/index.php?title=Some_page&curid=9327&diff=2075232&oldid=232555", "title": "Some page (-32554)", "fields": [{"name": "Usuni\u0119to", "value": "__Tylko znaki niedrukowane__", "inline": true}, {"name": "Dodano", "value": "__Tylko znaki niedrukowane__", "inline": true}, {"name": "Tagi", "value": "VisualEdit", "inline": false}], "author": {"name": "User3", "url": "https://minecraft.fandom.com/wiki/User:User3", "icon_url": ""}, "timestamp": "2022-03-26T11:41:22Z", "description": "Work on new as"}]},
|
||||
"edit": {"allowed_mentions": {"parse": []}, "avatar_url": "", "embeds": [{"color": 16711680, "url": "https://minecraft.fandom.com/index.php?title=Some_page&curid=9327&diff=2075232&oldid=232555", "title": "Some page (-32554)", "fields": [{"name": "Removed", "value": "__Only whitespace__", "inline": true}, {"name": "Added", "value": "__Only whitespace__", "inline": true}, {"name": "Tagi", "value": "VisualEdit", "inline": false}], "author": {"name": "User3", "url": "https://minecraft.fandom.com/wiki/User:User3", "icon_url": ""}, "timestamp": "2022-03-26T11:41:22Z", "description": "Work on new as"}]},
|
||||
"datadump/generate": {"allowed_mentions": {"parse": []}, "avatar_url": "", "embeds": [{"color": null, "author": {"name": "User 10", "url": "https://minecraft.fandom.com/wiki/User:User_10", "icon_url": ""}, "timestamp": "2022-01-13T15:25:09Z", "description": "", "title": "Generated Somefilenoidea.tar.gz dump", "url": "https://minecraft.fandom.com/wiki/Datadump"}]},
|
||||
"cargo/createtable":{"allowed_mentions": {"parse": []}, "avatar_url": "", "embeds": [{"color": null, "author": {"name": "User 10", "url": "https://minecraft.fandom.com/wiki/User:User_10", "icon_url": ""}, "timestamp": "2022-01-13T15:25:09Z", "description": "", "url": "https://somewiki.somefarm.com/wiki/Special:CargoTables/TableTest", "title": "Utworzono tabel\u0119 Cargo \u201eTableTest\u201d"}]},
|
||||
"abuselog": {"allowed_mentions": {"parse": []}, "avatar_url": "", "embeds": [{"color": null, "title": "User4 wywo\u0142a\u0142(a) \"Prevent vandalism\"", "fields": [{"name": "Wykonano", "value": "Edycja", "inline": false}, {"name": "Podj\u0119te dzia\u0142ania", "value": "Otagowano edycj\u0119", "inline": false}, {"name": "Tytu\u0142", "value": "Survival", "inline": false}]}]},
|
||||
"interwiki/iw_add": {"allowed_mentions": {"parse": []}, "avatar_url": "", "embeds": [{"color": null, "author": {"name": "Not An User", "url": "https://minecraft.fandom.com/wiki/User:Not_An_User", "icon_url": ""}, "timestamp": "2022-01-13T15:31:25Z", "url": "https://minecraft.fandom.com/wiki/Special:Interwiki", "title": "Dodano wpis do tabeli interwiki", "description": "Prefix: testonlypleaseignore, strona: https://notawiki.notaplatform.com/wiki/$1 | "}]}
|
||||
"cargo/createtable":{"allowed_mentions": {"parse": []}, "avatar_url": "", "embeds": [{"color": null, "author": {"name": "User 10", "url": "https://minecraft.fandom.com/wiki/User:User_10", "icon_url": ""}, "timestamp": "2022-01-13T15:25:09Z", "description": "", "url": "https://somewiki.somefarm.com/wiki/Special:CargoTables/TableTest", "title": "Created the Cargo table \"TableTest\""}]},
|
||||
"abuselog": {"allowed_mentions": {"parse": []}, "avatar_url": "", "embeds": [{"color": null, "title": "User4 triggered \"Prevent vandalism\"", "fields": [{"name": "Performed", "value": "Edit", "inline": false}, {"name": "Action taken", "value": "Tagged the edit", "inline": false}, {"name": "Title", "value": "Survival", "inline": false}]}]},
|
||||
"interwiki/iw_add": {"allowed_mentions": {"parse": []}, "avatar_url": "", "embeds": [{"color": null, "author": {"name": "Not An User", "url": "https://minecraft.fandom.com/wiki/User:Not_An_User", "icon_url": ""}, "timestamp": "2022-01-13T15:31:25Z", "url": "https://minecraft.fandom.com/wiki/Special:Interwiki", "title": "Added an entry to the interwiki table", "description": "Prefix: testonlypleaseignore, website: https://notawiki.notaplatform.com/wiki/$1 | "}]}
|
||||
}
|
39
test/test_11311_migration.py
Normal file
39
test/test_11311_migration.py
Normal file
File diff suppressed because one or more lines are too long
|
@ -55,5 +55,4 @@ class TestMWFormatter(unittest.TestCase):
|
|||
# ctx.client.return_value = Mock(spec=Client)
|
||||
edit_c, results = get_objects("abuselog")
|
||||
result = repr(test(ctx, edit_c))
|
||||
print(result)
|
||||
self.assertEqual(results, result)
|
||||
|
|
|
@ -62,5 +62,4 @@ class TestMWFormatter(unittest.TestCase):
|
|||
# ctx.client.return_value = Mock(spec=Client)
|
||||
edit_c, results = get_objects("cargo/createtable")
|
||||
result = repr(test(ctx, edit_c))
|
||||
print(result)
|
||||
self.assertEqual(results, result)
|
||||
|
|
|
@ -55,5 +55,4 @@ class TestMWFormatter(unittest.TestCase):
|
|||
# ctx.client.return_value = Mock(spec=Client)
|
||||
edit_c, results = get_objects("datadump/generate")
|
||||
result = repr(test(ctx, edit_c))
|
||||
print(result)
|
||||
self.assertEqual(results, result)
|
||||
|
|
|
@ -55,5 +55,4 @@ class TestMWFormatter(unittest.TestCase):
|
|||
# ctx.client.return_value = Mock(spec=Client)
|
||||
edit_c, results = get_objects("interwiki/iw_add")
|
||||
result = repr(test(ctx, edit_c))
|
||||
print(result)
|
||||
self.assertEqual(results, result)
|
||||
|
|
Loading…
Reference in a new issue