Esempio n. 1
0
class FetcherServiceTester(IonTestCase):
    """
    Just instantiate the FetcherService class and exercise the inner get_page
    method.
    """
    def setUp(self):
        self.mf = FetcherService()

    def test_single_page_with_headers(self):
        page = self.mf.get_page('http://amoeba.ucsd.edu/tmp/test1.txt',
                                get_headers=True)
        self.failUnlessSubstring('content-length', page)
        self.failUnlessSubstring('is the time for all', page)

    def test_no_headers(self):
        page = self.mf.get_page('http://amoeba.ucsd.edu/tmp/test1.txt')
        self.failIfSubstring('content-length', page)
        self.failUnlessSubstring('is the time for all', page)

    def test_bad_host(self):
        try:
            self.mf.get_page('http://foo.bar.baz/')
        except gaierror, ge:
            logging.debug('got err as expected! %s' % str(ge))
            pass
        except ValueError, ve:
            logging.debug('got err as expected: %s' % str(ve))
            pass
Esempio n. 2
0
class FetcherServiceTester(IonTestCase):
    """
    Just instantiate the FetcherService class and exercise the inner get_page
    method.
    """
    def setUp(self):
        self.mf = FetcherService()

    def test_single_page_with_headers(self):
        page = self.mf.get_page('http://amoeba.ucsd.edu/tmp/test1.txt',
                                get_headers=True)
        self.failUnlessSubstring('content-length', page)
        self.failUnlessSubstring('is the time for all', page)

    def test_no_headers(self):
        page = self.mf.get_page('http://amoeba.ucsd.edu/tmp/test1.txt')
        self.failIfSubstring('content-length', page)
        self.failUnlessSubstring('is the time for all', page)

    def test_bad_host(self):
        try:
            self.mf.get_page('http://foo.bar.baz/')
        except gaierror, ge:
            logging.debug('got err as expected! %s' % str(ge))
            pass
        except ValueError, ve:
            logging.debug('got err as expected: %s' % str(ve))
            pass
Esempio n. 3
0
 def setUp(self):
     self.mf = FetcherService()
Esempio n. 4
0
 def setUp(self):
     self.mf = FetcherService()