Changeset 2032dd08b000…
Parent 86f4efeffc0a…
by
Changes to one file · Browse files at 2032dd08b000 Showing diff from parent 86f4efeffc0a Diff from another changeset...
@@ -12,7 +12,7 @@ # not already exist when the test is initiated. The username and password
# given must have write access to that group.
-KILNAUTHPATH = '/code/kiln/2-0/extensions/kilnauth.py'
+KILNEXTPATH = '/code/kiln/2-0/extensions'
KILNURL = 'http://localhost/FogBugz/kiln'
USER = 'test'
PASSWORD = 'tester'
@@ -22,6 +22,13 @@# changes the home directory in the test script.
os.environ['HOME'] = os.path.expanduser('~' + getpass.getuser());
+# Paths for the individual extensions
+KILNAUTHPATH = KILNEXTPATH + '/kilnauth.py'
+GESTALTPATH = KILNEXTPATH + '/gestalt.py'
+KILNPATHPATH = KILNEXTPATH + '/kilnpath.py'
+BIGPUSHPATH = KILNEXTPATH + '/big-push.py'
+KILNPATH = KILNEXTPATH + '/kiln.py'
+
def api(url):
return KILNURL + '/api/1.0/' + url
@@ -60,12 +67,43 @@ while slurp(api('Repo/%d' % ixRepo), dict(token=token))['sStatus'] != 'good':
time.sleep(0.1)
- return (KILNURL + '/Repo/Test/Test/test', ixRepo)
+ return (KILNURL + '/Repo/Test/Test/Test', ixRepo)
+
+def createtestbranch(hgt, token, ixParent):
+ projects = slurp(api('Project'), dict(token=token))
+
+ found = False
+ for project in projects:
+ if project['sName'] == 'Test':
+ ixProject = project['ixProject']
+ for group in project['repoGroups']:
+ if group['sName'] == 'Test':
+ ixRepoGroup = group['ixRepoGroup']
+ found = True
+
+ if not found:
+ return None
+
+ time.sleep(1)
+ while slurp(api('Repo/%d' % ixParent), dict(token=token))['sStatus'] != 'good':
+ time.sleep(0.1)
+
+ repo = slurp(api('Repo/Create'), dict(sName='TestBranch', sDescription='test branch', ixRepoGroup=ixRepoGroup, ixParent=ixParent, fCentral=False, sDefaultPermission='write', token=token))
+ ixRepo = repo['ixRepo']
+
+ hgt.asserttrue(isinstance(ixRepo, int), 'Create failed %s' % (str(ixRepo)))
+
+ time.sleep(1)
+ while slurp(api('Repo/%d' % ixRepo), dict(token=token))['sStatus'] != 'good':
+ time.sleep(0.1)
+
+ return (KILNURL + '/Repo/Test/Test/TestBranch', ixRepo)
def deletetest(hgt, token):
projects = slurp(api('Project'), dict(token=token))
found = False
+ foundBranch = False
for project in projects:
if project['sName'] == 'Test':
ixProject = project['ixProject']
@@ -76,14 +114,22 @@ if repo['sName'] == 'Test':
ixRepo = repo['ixRepo']
found = True
- if not found:
- return None
- slurp(api('Repo/%d/Delete' % ixRepo), dict(token=token), post=True)
-
- try:
- while True:
- slurp(api('Repo/%d' % ixRepo), dict(token=token))
- time.sleep(0.1)
- except urllib2.HTTPError:
- pass
-
+ if repo['sName'] == 'TestBranch':
+ ixBranch = repo['ixRepo']
+ foundBranch = True
+ if foundBranch:
+ slurp(api('Repo/%d/Delete' % ixBranch), dict(token=token), post=True)
+ try:
+ while True:
+ slurp(api('Repo/%d' % ixBranch), dict(token=token))
+ time.sleep(0.1)
+ except urllib2.HTTPError:
+ pass
+ if found:
+ slurp(api('Repo/%d/Delete' % ixRepo), dict(token=token), post=True)
+ try:
+ while True:
+ slurp(api('Repo/%d' % ixRepo), dict(token=token))
+ time.sleep(0.1)
+ except urllib2.HTTPError:
+ pass
|
Loading...