aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobert Loehning <robert.loehning@qt.io>2018-07-27 16:16:12 +0200
committerRobert Loehning <robert.loehning@qt.io>2018-07-31 10:02:18 +0000
commit6d7eb57e750d63d350b9aedddb3eacb50e961a22 (patch)
tree62ae54b0a200259dc24bee00fa9d65750956b7ca /tests
parent8c0042da40c13c1ad5cf768e2e019f6d2a3f06e8 (diff)
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 <christian.stenger@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/system/suite_tools/tst_codepasting/test.py18
1 files 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 b2df4f9943..b91ce2e558 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