Exemplo n.º 1
0
 def test_get_next_proxy(self):
     pl = ProxyList()
     path = self.generate_plist_file('foo:1\nbar:1')
     pl.set_source('file', location=path)
     self.assertEqual(pl.get_next_proxy().server, 'foo')
     self.assertEqual(pl.get_next_proxy().server, 'bar')
     self.assertEqual(pl.get_next_proxy().server, 'foo')
     pl.set_source('file', location=path)
     self.assertEqual(pl.get_next_proxy().server, 'foo')
Exemplo n.º 2
0
Arquivo: proxy.py Projeto: subeax/grab
 def test_get_next_proxy(self):
     pl = ProxyList()
     path = self.generate_plist_file('foo:1\nbar:1')
     pl.set_source('file', location=path)
     self.assertEqual(pl.get_next_proxy().server, 'foo')
     self.assertEqual(pl.get_next_proxy().server, 'bar')
     self.assertEqual(pl.get_next_proxy().server, 'foo')
     pl.set_source('file', location=path)
     self.assertEqual(pl.get_next_proxy().server, 'foo')
Exemplo n.º 3
0
    def test_get_next_proxy_in_accumulate_mode(self):
        pl = ProxyList()
        pl.setup(accumulate_updates=True)

        path = self.generate_plist_file('foo:1\nbar:1')
        pl.set_source('file', location=path)
        self.assertEqual(pl.get_next_proxy().server, 'foo')

        path = self.generate_plist_file('baz:1')
        pl.set_source('file', location=path)
        self.assertEqual(pl.get_next_proxy().server, 'bar')
        self.assertEqual(pl.get_next_proxy().server, 'baz')
        self.assertEqual(pl.get_next_proxy().server, 'foo')
Exemplo n.º 4
0
Arquivo: proxy.py Projeto: subeax/grab
    def test_get_next_proxy_in_accumulate_mode(self):
        pl = ProxyList()
        pl.setup(accumulate_updates=True)

        path = self.generate_plist_file('foo:1\nbar:1')
        pl.set_source('file', location=path)
        self.assertEqual(pl.get_next_proxy().server, 'foo')

        path = self.generate_plist_file('baz:1')
        pl.set_source('file', location=path)
        self.assertEqual(pl.get_next_proxy().server, 'bar')
        self.assertEqual(pl.get_next_proxy().server, 'baz')
        self.assertEqual(pl.get_next_proxy().server, 'foo')