Example #1
0
    def setUp(self):
        self.proxy_checker = ProxyChecker()

        self.working = "google.com on 80 is working now."
        self.not_working = "google.com on 1337 is not working."
Example #2
0
class TestProxyChecker(unittest.TestCase):
    def setUp(self):
        self.proxy_checker = ProxyChecker()

        self.working = "google.com on 80 is working now."
        self.not_working = "google.com on 1337 is not working."

    def test_run(self):
        # Тест по 1 прокси.
        # Гугл должен всегда работать, и подходить тестам.
        self.proxy_checker.set("proxy", "google.com:80")
        self.assertTupleEqual(self.proxy_checker.run(), (self.working,))

        self.proxy_checker.set("proxy", "google.com:1337")
        self.assertTupleEqual(self.proxy_checker.run(), (self.not_working,))

        # Тест по файлу проксей.
        self.proxy_checker.set("proxy", "ip:port")
        self.proxy_checker.set("proxy_file", "/home/dima/develop/gideon/tests/hacking/test_proxy_file.txt")
        self.assertTupleEqual(self.proxy_checker.run(), (self.working, self.not_working))