Beispiel #1
0
def proxy(request):
    proxy = Proxy()
    proxy.start()
    def fin():
        proxy = hubcheck.conf.settings.proxy
        if proxy is not None:
            proxy.stop()

    request.addfinalizer(fin)
    return proxy
Beispiel #2
0
    def test_stop_1(self):
        """
        stop the proxy server
        at the end of the process the following should be true:
        1. hubcheck.conf.settings.proxy is None
        2. proxy.port is not listening
        """

        proxy = Proxy()
        proxy.start()
        proxy.stop()

        assert hubcheck.conf.settings.proxy is None
        assert is_port_listening('localhost',proxy.port) is False
Beispiel #3
0
    def test_start_1(self):
        """
        setup a new proxy server with valid inputs and start it
        at the end of the process the following should be true:
        1. hubcheck.conf.settings.proxy is not None
        2. proxy.port is listening
        3. /tmp/userAgentString.properties is populated
        4. /tmp/userAgentString.txt is populated
        """

        assert hubcheck.conf.settings.proxy is None

        proxy = Proxy()
        proxy.start()

        assert hubcheck.conf.settings.proxy is not None
        assert is_port_listening('localhost',proxy.port) is True
        assert os.path.isfile('/tmp/userAgentString.properties')
        assert os.path.isfile('/tmp/userAgentString.txt')