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>
This commit is contained in:
Robert Loehning
2018-07-27 16:16:12 +02:00
parent 8c0042da40
commit 6d7eb57e75

View File

@@ -25,10 +25,14 @@
source("../../shared/qtcreator.py") source("../../shared/qtcreator.py")
import random 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 # Be careful with Pastebin.Com, there are only 10 pastes per 24h
# for all machines using the same IP-address like you. # for all machines using the same IP-address like you.
skipPastingToPastebinCom = True skipPastingToPastebinCom = platform.system() not in __platformToBeRunToday__()
NAME_KDE = "Paste.KDE.Org" NAME_KDE = "Paste.KDE.Org"
NAME_PBCA = "Pastebin.Ca" NAME_PBCA = "Pastebin.Ca"
@@ -197,8 +201,16 @@ def main():
else: # if it was not our own exception re-raise else: # if it was not our own exception re-raise
raise e raise e
if not pasteId: if not pasteId:
test.fatal("Could not get id of paste to %s" % protocol) message = "Could not get id of paste to %s" % protocol
continue 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) pasteId = fetchSnippet(protocol, description, pasteId, skippedPasting)
if pasteId == -1: if pasteId == -1:
continue continue