From 6d7eb57e750d63d350b9aedddb3eacb50e961a22 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Fri, 27 Jul 2018 16:16:12 +0200 Subject: [PATCH] Squish: Test pasting with pastebin.com Yes, there are only ten pastes per IP per day. But doesn't that mean that nobody can rely on it being availabe anyway? So it's better to use some of those ten pastes for testing instead of not testing pasting at all. Change-Id: I45362e5ab0c3eb43f1ddd18d4be39474e26c8460 Reviewed-by: Christian Stenger --- .../system/suite_tools/tst_codepasting/test.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/system/suite_tools/tst_codepasting/test.py b/tests/system/suite_tools/tst_codepasting/test.py index b2df4f9943a..b91ce2e5585 100644 --- a/tests/system/suite_tools/tst_codepasting/test.py +++ b/tests/system/suite_tools/tst_codepasting/test.py @@ -25,10 +25,14 @@ source("../../shared/qtcreator.py") import random +from datetime import date + +def __platformToBeRunToday__(): + return (('Linux'), ('Darwin'), ('Microsoft', 'Windows'))[date.today().day % 3] # Be careful with Pastebin.Com, there are only 10 pastes per 24h # for all machines using the same IP-address like you. -skipPastingToPastebinCom = True +skipPastingToPastebinCom = platform.system() not in __platformToBeRunToday__() NAME_KDE = "Paste.KDE.Org" NAME_PBCA = "Pastebin.Ca" @@ -197,8 +201,16 @@ def main(): else: # if it was not our own exception re-raise raise e if not pasteId: - test.fatal("Could not get id of paste to %s" % protocol) - continue + message = "Could not get id of paste to %s" % protocol + if protocol == NAME_PBCOM: + test.log("%s, using prepasted file instead" % message) + skippedPasting = True + pasteId = "8XHP0ZgH" + pastedText = readFile(os.path.join(os.getcwd(), + "testdata", "main-prepasted.cpp")) + else: + test.fatal(message) + continue pasteId = fetchSnippet(protocol, description, pasteId, skippedPasting) if pasteId == -1: continue