test.test_api_usage: fix secscan tests
This commit is contained in:
parent
3286566478
commit
1d6339e644
2 changed files with 27 additions and 25 deletions
|
@ -5,6 +5,7 @@ import urlparse
|
|||
|
||||
from contextlib import contextmanager
|
||||
from httmock import urlmatch, HTTMock, all_requests
|
||||
|
||||
from util.secscan.api import UNKNOWN_PARENT_LAYER_ERROR_MSG, compute_layer_id
|
||||
|
||||
@contextmanager
|
||||
|
@ -170,7 +171,6 @@ class FakeSecurityScanner(object):
|
|||
|
||||
def get_endpoints(self):
|
||||
""" Returns the HTTMock endpoint definitions for the fake security scanner. """
|
||||
|
||||
@urlmatch(netloc=r'(.*\.)?' + self.hostname, path=r'/v1/layers/(.+)', method='GET')
|
||||
def get_layer_mock(url, request):
|
||||
layer_id = url.path[len('/v1/layers/'):]
|
||||
|
@ -320,7 +320,7 @@ class FakeSecurityScanner(object):
|
|||
def response_content(url, _):
|
||||
return {
|
||||
'status_code': 500,
|
||||
'content': '',
|
||||
'content': json.dumps({'Error': {'Message': 'Unknown endpoint %s' % url.path}}),
|
||||
}
|
||||
|
||||
return [get_layer_mock, post_layer_mock, remove_layer_mock, get_notification,
|
||||
|
|
Reference in a new issue