diff options
author | 2018-07-31 09:32:05 +0200 | |
---|---|---|
committer | 2018-07-31 13:58:59 +0200 | |
commit | 7a1e0c8a922f60b9443179ca874d5966afdc54a7 (patch) | |
tree | 0d25bb57bb9837a6df8a305cccf69c6b888710d5 /test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py | |
parent | 3cbe54761c77812594cf6c497482373e814792c1 (diff) |
Cleaning tests
- Removed problem with version docker package
- Change from python2 to python3
Issue-ID: INT-604
Change-Id: I4c5669926198569871634a7fed541b21aaa91eb9
Signed-off-by: Mariusz Wagner <mariusz.wagner@nokia.com>
Diffstat (limited to 'test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py')
-rw-r--r-- | test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py index dd2d19451..210378421 100644 --- a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py +++ b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py @@ -1,12 +1,13 @@ -import BaseHTTPServer +from http.server import BaseHTTPRequestHandler +from http.server import HTTPServer import re import sys -posted_event_from_prh = 'Empty' +posted_event_from_prh = b'Empty' received_event_to_get_method = 'Empty' -class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler): +class DMaaPHandler(BaseHTTPRequestHandler): def do_PUT(self): if re.search('/set_get_event', self.path): global received_event_to_get_method @@ -29,11 +30,9 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler): if re.search('/events/unauthenticated.SEC_OTHER_OUTPUT/OpenDcae-c12/c12', self.path): _header_200_and_json(self) self.wfile.write(received_event_to_get_method) - self.wfile.close() elif re.search('/events/pnfReady', self.path): _header_200_and_json(self) self.wfile.write(posted_event_from_prh) - self.wfile.close() return @@ -44,7 +43,7 @@ def _header_200_and_json(self): self.end_headers() -def _main_(handler_class=DMaaPHandler, server_class=BaseHTTPServer.HTTPServer, protocol="HTTP/1.0"): +def _main_(handler_class=DMaaPHandler, server_class=HTTPServer, protocol="HTTP/1.0"): if sys.argv[1:]: port = int(sys.argv[1]) @@ -57,7 +56,7 @@ def _main_(handler_class=DMaaPHandler, server_class=BaseHTTPServer.HTTPServer, p httpd = server_class(server_address, handler_class) sa = httpd.socket.getsockname() - print "Serving HTTP on", sa[0], "port", sa[1], "..." + print("Serving HTTP on", sa[0], "port", sa[1], "...") httpd.serve_forever() |