Use the same user for tempest test user and alt user.

Tempest test will use the same user for Test User and ALT User.
So, only ask for Test User password and apply that to both users.

Change-Id: Ie37faf011cdf54954b882dd31aadaa9ce0c01b1f
This commit is contained in:
Raymond Wong 2014-03-12 11:59:09 -07:00
parent 44d506c09a
commit d03a934d8f
2 changed files with 11 additions and 10 deletions

View File

@ -4,14 +4,12 @@
<h2>Test Cloud</h2>
<form action = "" method = 'post'>
<dl>
<dt>Label:</dt>
<dt>Test Run Name:</dt>
<dd><input type = 'text' name = 'label' size = '30' value = "{{ request.values.label }}"></dd>
<dt>Test User Password:</dt>
<dt>Test User ({{ names.user }}) Password:</dt>
<dd><input type = 'password' name = 'pw_user' size = '30' value = "{{ request.values.pw_user }}"></dd>
<dt>Admin User Password:</dt>
<dt>Admin User ({{ names.admin }}) Password:</dt>
<dd><input type = 'password' name = 'pw_admin' size = '30' value = "{{ request.values.pw_admin }}"></dd>
<dt>Alternate User Password:</dt>
<dd><input type = 'password' name = 'pw_alter_user' size = '30' value = "{{ request.values.pw_alter_user }}"></dd>
</dl>
<p>
<input type = 'button' value = "Cancel" onclick = "location.href = '/'">

View File

@ -265,24 +265,27 @@ def test_cloud(cloud_id):
return redirect('/')
elif not c.user_id == g.user.id:
flash(u"This isn't your cloud!")
return redirect('/')
if request.method == 'POST':
REQUIRED_FIELDS = ('label', 'pw_admin', 'pw_user', 'pw_alter_user')
if not all(field in request.form for field in REQUIRED_FIELDS):
REQUIRED_FIELDS = ('label', 'pw_admin', 'pw_user')
if not all(request.form[field] for field in REQUIRED_FIELDS):
flash(u'Error: All fields are required')
else:
''' Construct confJSON with the passwords provided '''
pw_admin = request.form['pw_admin']
pw_user = request.form['pw_user']
pw_alt = request.form['pw_alter_user']
# Using the same user for alt_user
pw_alt = request.form['pw_user']
jstr = '{"identity":{"password":"%s","admin_password":"%s",\
"alt_password":"%s"}}' % (pw_user, pw_admin, pw_alt)
TempestTester().test_cloud(cloud_id, jstr)
flash(u'Test Started!')
return redirect('/')
return render_template('test_cloud.html', next_url='/')
names = dict(user=c.test_user, admin=c.admin_user)
return render_template('test_cloud.html', next_url='/', names=names)
@app.route('/get-script', methods=['GET'])