Beispiel #1
0
    def test_no_dns_resolve(self):
        from loads import measure
        old = measure.dns_resolve

        def fail(*args, **kw):
            raise AssertionError()

        measure.dns_resolve = fail
        test = _FakeTest()
        test_result = _TestResult()

        try:
            session = Session(test, test_result)
            self.assertRaises(AssertionError, session.get,
                              'http://impossible.place')
            session = Session(test, test_result, dns_resolve=False)
            session.get('http://impossible.place')
        finally:
            measure.dns_resolve = old
Beispiel #2
0
 def test_session(self):
     test = _FakeTest()
     test_result = _TestResult()
     session = Session(test, test_result)
     session.get('http://impossible.place')
     self.assertEqual(len(test_result.data), 1)
Beispiel #3
0
 def test_session(self):
     test = _FakeTest()
     test_result = _TestResult()
     session = Session(test, test_result)
     session.get('http://impossible.place')
     self.assertEqual(len(test_result.data), 1)