diff options
author | Paul Bonaud <paul.bonaud@fretlink.com> | 2020-01-02 15:25:06 +0100 |
---|---|---|
committer | Paul Bonaud <paul.bonaud@fretlink.com> | 2020-01-02 15:50:17 +0100 |
commit | a3c4b3d5444e5d79afbd823a9acc12220a91f41f (patch) | |
tree | 02c178a19be0e233813600531c85ef7ad5e4c51c /tests | |
parent | 8dd292407aa6ab7879807120d5824993013e2eba (diff) | |
download | ansible-kong-app-a3c4b3d5444e5d79afbd823a9acc12220a91f41f.tar.gz ansible-kong-app-a3c4b3d5444e5d79afbd823a9acc12220a91f41f.tar.zst ansible-kong-app-a3c4b3d5444e5d79afbd823a9acc12220a91f41f.zip |
tests: fake a Kong server
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/kong.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/kong.py b/tests/kong.py new file mode 100755 index 0000000..32bafb2 --- /dev/null +++ b/tests/kong.py | |||
@@ -0,0 +1,22 @@ | |||
1 | #!/usr/bin/env python | ||
2 | |||
3 | from http.server import HTTPServer, CGIHTTPRequestHandler | ||
4 | |||
5 | class SimpleHTTPRequestHandler(CGIHTTPRequestHandler): | ||
6 | def do_GET(self): | ||
7 | if self.path == '/services/test': | ||
8 | self.send_response(404) | ||
9 | else: | ||
10 | self.send_response(200) | ||
11 | self.send_header('Content-Type', 'application/json') | ||
12 | self.end_headers() | ||
13 | self.wfile.write(b'{ "data": [] }') | ||
14 | |||
15 | def do_POST(self): | ||
16 | self.send_response(200) | ||
17 | self.end_headers() | ||
18 | self.wfile.write(b'Hello, world!') | ||
19 | |||
20 | |||
21 | httpd = HTTPServer(('127.0.0.1', 8000), SimpleHTTPRequestHandler) | ||
22 | httpd.serve_forever() | ||