Skip to content

Commit

Permalink
OpenBankProject#38 Run button should be written as "Run" (it's curren…
Browse files Browse the repository at this point in the history
…tly "Test")

OpenBankProject#39 Delete button should be Red, not green Run button should be green
OpenBankProject#40 BASE_URL should be renamed to OAUTH_BASE_URL
  • Loading branch information
PengfeiLi0218 committed Jan 7, 2019
1 parent 818a3e4 commit a8d498d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion apitester/apitester/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,4 @@

# Settings here might use parts overwritten in local settings
API_ROOT = API_HOST + API_BASE_PATH + API_VERSION
BASE_URL='http://127.0.0.1:8000'
OAUTH_BASE_URL='http://127.0.0.1:8000'
2 changes: 1 addition & 1 deletion apitester/obp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def get_callback_uri(self, request):
initiation at OAuth server
"""
#base_url = '{}://{}'.format(request.scheme, request.environ['HTTP_HOST'])
base_url = settings.BASE_URL
base_url = settings.OAUTH_BASE_URL
uri = base_url + reverse('oauth-authorize')
if 'next' in request.GET:
uri = '{}?next={}'.format(uri, request.GET['next'])
Expand Down
3 changes: 3 additions & 0 deletions apitester/runtests/static/runtests/js/runtests.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ $(function() {
}
}
});

$('.runner button.forTest').click(function() {
var runner = $(this).parent().parent().parent();
$(runner).find('.result').empty();
runTest(runner);
});

$('.runner button.forSave').click(function() {
var t = $(this)
var runner = $(this).parent().parent().parent();
Expand Down Expand Up @@ -131,6 +133,7 @@ $(function() {
$('#checkNone').click(function() {
$('.runner').find('input').prop('checked', false);
});

$('#checkAll').click(function() {
$('.runner').find('input').prop('checked', true);
});
Expand Down
10 changes: 5 additions & 5 deletions apitester/runtests/templates/runtests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ <h2>{{ config.name }}</h2>
<div class="col-xs-12 col-sm-2">
<button class="btn btn-default form-control" id="checkAll" />Check all</button>
</div>
<div class="col-xs-12 col-sm-4">
<div class="col-xs-2">
<label>runs num: </label><input type="text" name="numRun" size="1" value=1 />
</div>
</div>
</div>
Expand All @@ -155,16 +156,15 @@ <h2>{{ config.name }}</h2>
{% endif %}
</div>
<div class="col-xs-1">order: <input class="form-control" type="text" name="order" size="1" value="{{ call.order }}" /></div>
<div class="col-xs-1">runs num: <input class="form-control" type="text" name="numRun" size="1" value=1 /></div>
<div class="col-xs-1"><input class="form-control" type="hidden" name="replica_id" size="1" value="{{ call.replica_id }}" /></div>
<div class="col-xs-1">{{ call.method |upper}}<input class="form-control" type="hidden" name="method" size="1" value="{{ call.method }}" /></div>
<div class="col-xs-1 col-sm-1">
<button class="btn btn-default forTest" id="forTest">Test</button>
<button class="btn btn-success forTest" id="forTest">Run</button>
<button class="btn btn-default forCopy" id="forCopy">Copy</button>
</div>
<div class="col-xs-1 col-sm-1">
<button class="btn btn-success forDelete" id="forDelete">Delete</button>
<button class="btn btn-success forSave" id="forSave">Save</button><span style="display: none;margin-left: 5px;background-color:#00cc00">saved.</span>
<button class="btn btn-success forDelete" style="background: red;" id="forDelete">Delete</button>
<button class="btn btn-default forSave" id="forSave">Save</button><span style="display: none;margin-left: 5px;background-color:#00cc00">saved.</span>
</div>
<div class="col-xs-12 col-sm-9 result"></div>

Expand Down
7 changes: 1 addition & 6 deletions apitester/runtests/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,18 +321,13 @@ def get_context_data(self, **kwargs):
'success': False,
})

num_runs = int(config['num_runs'])

if not config['found']:
msg = 'Unknown path {}!'.format(kwargs['testpath'])
context['messages'].append(msg)
return context

try:
for i in range(num_runs):
result = self.run_test(config)
LOGGER.log(logging.INFO,result)
time.sleep(t)
result = self.run_test(config)
except APIError as err:
context['messages'].append(err)
return context
Expand Down

0 comments on commit a8d498d

Please sign in to comment.