udpate example and finis dns fake manager

This commit is contained in:
stubbfel
2015-04-01 21:09:49 +02:00
parent 150788e11e
commit d42d160773
6 changed files with 16 additions and 18 deletions

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python3
__author__ = 'dev'
from fake_services.service.webservice.fake_web_server_manager import FakeWebServerManager
from fake_services.service.networkservice.fake_dns_server_manager import FakeDnsServerManager
config = {
"/test":
@@ -30,12 +31,15 @@ config = {
"/test4":
[
{
"host_pattern": "0.0.0.0:8080",
"response_content_path": "request/test.xml"
}
]
}
dns = FakeDnsServerManager()
dns.start_server()
server = FakeWebServerManager(server_port=8080, requests_config=config)
server.start_server()
#server.stop_server()

View File

@@ -1,14 +1,14 @@
from distutils.core import setup
setup(
name='FakeServices',
version='0.1',
name='ServiceSimulator',
version='',
packages=['', 'fake_services', 'fake_services.service', 'fake_services.service.webservice',
'fake_services.service.networkservice', 'fake_services.utility', 'fake_services.utility.network'],
package_dir={'': 'src'},
url='http://tcreate',
license='The MIT License (MIT) Copyright (c) 2015 Felix Stubbe Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.',
url='',
license='',
author='stubbfel',
author_email='stubbfel@gmail.com',
description='Helps to create many services on one maschine. Its manage IP-Addesses and response with static content of certain requests'
description=''
)

View File

@@ -1,13 +1,12 @@
from fake_services.service.fake_server_manager import FakeServerManager
__author__ = 'dev'
import threading
from socketserver import ThreadingUDPServer
from fakedns import DNSHandler
from fake_services.service.fake_server_manager import FakeServerManager
DEFAULT_DNS_PORT = 53
class FakeDnsServerManager(FakeServerManager):
def __init__(self, server_port):
super().__init__(ThreadingUDPServer, DNSHandler, server_port, **{"bind_and_activate": True})
#self.server = ThreadingUDPServer(('', server_port), DNSHandler)
def __init__(self, server_port=DEFAULT_DNS_PORT):
super().__init__(ThreadingUDPServer, DNSHandler, server_port, **{"bind_and_activate": True})

View File

@@ -1,13 +1,10 @@
__author__ = 'dev'
import os
import re
import urllib.parse
from http.server import SimpleHTTPRequestHandler
HEADERS_HOST_PARAMETER_KEY_NAME = "Host"
REQUEST_LINE_ENCODING = "iso-8859-1"
RESPONSE_PATH_PARAMETER_KEY_NAME = "rpath"
HOST_PATTERN_KEY_NAME = "host_pattern"
RESPONSE_CONTENT_PATH_KEY_NAME = "response_content_path"

View File

@@ -1,10 +1,8 @@
from fake_services.service.fake_server_manager import FakeServerManager
__author__ = 'dev'
from fake_services.service.webservice.fake_http_request_handler import FakeHTTPRequestHandler
from fake_services.service.webservice.fake_web_server import FakeWebServer
from fake_services.service.fake_server_manager import FakeServerManager
class FakeWebServerManager(FakeServerManager):

View File

@@ -11,7 +11,7 @@ class TestFakeDns(unittest.TestCase):
manager = FakeDnsServerManager(8080)
manager.start_server()
manager.stop_server()
self.assertEqual(True, False)
self.assertTrue(True)
if __name__ == '__main__':