summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@digia.com>2014-01-24 17:20:06 +0100
committerChristian Stenger <christian.stenger@digia.com>2014-01-29 14:50:13 +0100
commit076f6e690f910628604c146ab68f33af823ec180 (patch)
tree2b1a472524fcc41d4b05a8bcac18ed90f6e0f112
parent06d34f5a12a55e7831b1c4a5e5edf495a10a681e (diff)
downloadqt-creator-076f6e690f910628604c146ab68f33af823ec180.tar.gz
Squish: Enter dummy values if committer info is missing
Change-Id: Ic97de439b994a359cb0eae977cd0ec3cb780b081 Reviewed-by: Robert Loehning <robert.loehning@digia.com>
-rw-r--r--tests/system/suite_tools/tst_git_local/test.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/system/suite_tools/tst_git_local/test.py b/tests/system/suite_tools/tst_git_local/test.py
index 41770e9feb..a67d24783b 100644
--- a/tests/system/suite_tools/tst_git_local/test.py
+++ b/tests/system/suite_tools/tst_git_local/test.py
@@ -40,6 +40,8 @@ def commit(commitMessage, expectedLogMessage):
invokeMenuItem("Tools", "Git", "Local Repository", "Commit...")
replaceEditorContent(waitForObject(":Description.description_Utils::CompletingTextEdit"), commitMessage)
ensureChecked(waitForObject(":Files.Check all_QCheckBox"))
+ checkOrFixCommitterInformation('invalidAuthorLabel', 'authorLineEdit', 'Nobody')
+ checkOrFixCommitterInformation('invalidEmailLabel', 'emailLineEdit', 'nobody@nowhere.com')
clickButton(waitForObject(":splitter.Commit File(s)_VcsBase::QActionPushButton"))
vcsLog = waitForObject("{type='QPlainTextEdit' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}").plainText
@@ -53,6 +55,22 @@ def verifyItemsInGit(commitMessages):
verifyItemOrder(commitMessages, plainText)
return plainText
+def createLocalGitConfig(path):
+ config = os.path.join(path, "config")
+ test.verify(os.path.exists(config), "Verifying if .git/config exists.")
+ file = open(config, "a")
+ file.write("\n[user]\n\temail = nobody@nowhere.com\n\tname = Nobody\n")
+ file.close()
+
+def checkOrFixCommitterInformation(labelName, lineEditName, expected):
+ lineEd = waitForObject("{name='%s' type='QLineEdit' visible='1'}" % lineEditName)
+ if not (test.compare(lineEd.text, expected, "Verifying commit information matches local config")
+ and test.verify(checkIfObjectExists("{name='%s' type='QLabel' visible='1'}" % labelName,
+ False, 1000),
+ "Verifying invalid label is missing")):
+ test.log("Commit information invalid or missing - entering dummy value (%s)" % expected)
+ replaceEditorContent(lineEd, expected)
+
def verifyClickCommit():
gitEditor = waitForObject(":Qt Creator_Git::Internal::GitEditor")
fileName = waitForObject(":Qt Creator_FilenameQComboBox")
@@ -82,7 +100,7 @@ def verifyClickCommit():
waitFor('len(str(diffShow.plainText)) != 0', 5000)
show = str(diffShow.plainText)
expected = [{"commit %s" % commit:False},
- {"Author: (\w|\s)+ <(\w|[-.])+@(\w|[-.])+>": True},
+ {"Author: Nobody <nobody@nowhere.com>": False},
{"Date:\s+\w{3} \w{3} \d{1,2} \d{2}:\d{2}:\d{2} \d{4}.*":True},
{"Branches: master":False}]
for line, exp in zip(show.splitlines(), expected):
@@ -127,6 +145,7 @@ def main():
test.verify("Initialized empty Git repository in %s"
% os.path.join(srcPath, projectName, ".git").replace("\\", "/") in str(vcsLog),
"Has initialization of repo been logged:\n%s " % vcsLog)
+ createLocalGitConfig(os.path.join(srcPath, projectName, ".git"))
commitMessages = [commit("Initial Commit", "Committed 5 file(s).")]
clickButton(waitForObject(":*Qt Creator.Clear_QToolButton"))
addCPlusPlusFileToCurrentProject("pointless_header.h", "C++ Header File", addToVCS = "Git")