diff --git a/extensions/mockserverlibrary.patch b/extensions/mockserverlibrary.patch deleted file mode 100644 index 8097a9d0dd924a57b59d40d73513c806415979bf..0000000000000000000000000000000000000000 --- a/extensions/mockserverlibrary.patch +++ /dev/null @@ -1,59 +0,0 @@ -diff --git a/src/MockServerLibrary/library.py b/src/MockServerLibrary/library.py -index a9e6227..7ba1eed 100644 ---- a/src/MockServerLibrary/library.py -+++ b/src/MockServerLibrary/library.py -@@ -66,6 +66,9 @@ class MockServerLibrary(object): - match_type = 'STRICT' if exact else 'ONLY_MATCHING_FIELDS' - req['body'] = {'type': body_type, 'json': json.dumps(body), 'matchType': match_type} - -+ if body_type is 'JSON_SCHEMA' and body: -+ req['body'] = {'type': body_type, 'json': json.dumps(body)} -+ - return req - - def create_mock_response(self, status_code, headers=None, body_type='JSON', body=None): -@@ -97,6 +100,42 @@ class MockServerLibrary(object): - - return rsp - -+ def create_mock_http_forward(self, path, delay=1, unit='SECONDS'): -+ """Creates a mock http override forward to be used by mockserver. -+ -+ Returns the http forward in a dictionary format. -+ -+ `path` is the new url where to forward the request -+ -+ `delay` is the delay of the forward action -+ -+ `unit` is the unit of the delay time (default "SECONDS") -+ """ -+ fwd = {} -+ fwd['httpRequest'] = {'path': path} -+ fwd['delay'] = {'timeUnit': unit, 'value': delay} -+ -+ return fwd -+ -+ def create_mock_expectation_with_http_forward(self, request, forward, count=1, unlimited=True): -+ """Creates a mock expectation with request and forward action to be used by mockserver. -+ -+ `request` is a mock request matcher in a dictionary format. -+ -+ `forward` is a mock forward in a dictionary format. -+ -+ `count` is the number of expected requests -+ -+ `unlimited` is a boolean value which, if enabled, allows unspecified number of -+ requests to reply to -+ """ -+ data = {} -+ data['httpRequest'] = request -+ data['httpOverrideForwardedRequest'] = forward -+ data['times'] = {'remainingTimes': int(count), 'unlimited': unlimited} -+ -+ self.create_mock_expectation_with_data(data) -+ - def create_mock_expectation(self, request, response, count=1, unlimited=True): - """Creates a mock expectation to be used by mockserver. - - - diff --git a/requirements.txt b/requirements.txt index 2c8b44f1d4ef33cd592c4487a4e6fff9c59b6b39..089875dd80103f475c0a58719ed1eaf12f606eea 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,3 +8,4 @@ robotframework-dependencylibrary==1.0.0.post1 robotframework-jsonlibrary==0.3 robotframework-jsonschemalibrary==1.0 robotframework-requests==0.5.0 +robotframework-mockserver>=0.0.7 diff --git a/scripts/docker/Dockerfile b/scripts/docker/Dockerfile index 6b9bf39082c30df67840bcf629f3b01f3f70b4cd..f09948e4a43bd4f2f9cfca28d4bb42f680157882 100644 --- a/scripts/docker/Dockerfile +++ b/scripts/docker/Dockerfile @@ -42,11 +42,7 @@ RUN pip3 install robotframework RUN DEBIAN_FRONTEND=noninteractive \ && cd /home/etsi/dev/robot \ && pip3 install -r requirements.txt \ - && chmod +x /home/etsi/dev/robot/scripts/* \ - && git clone https://github.com/etsi-cti-admin/robotframework-mockserver \ - && cd robotframework-mockserver \ - && patch -p1 < ../extensions/mockserverlibrary.patch \ - && python3 -m pip install -e . + && chmod +x /home/etsi/dev/robot/scripts/* CMD tail -f /dev/null