forked from qt-creator/qt-creator
Squish: Enter dummy values if committer info is missing
Change-Id: Ic97de439b994a359cb0eae977cd0ec3cb780b081 Reviewed-by: Robert Loehning <robert.loehning@digia.com>
This commit is contained in:
@@ -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")
|
||||
|
Reference in New Issue
Block a user