Esempio n. 1
0
 def test_connect_fail(self):
     api = RavelloClient(retries=3, timeout=5)
     parsed = urlparse.urlsplit(env.service_url)
     ipaddr = socket.gethostbyname(parsed.netloc)
     with networkblocker.block_ip(ipaddr):
         assert_raises(RavelloError, api.connect, env.service_url)
     # RavelloClient.connect does not retry
     assert api._total_retries == 0
Esempio n. 2
0
 def test_retry_fail(self):
     api = RavelloClient(retries=3, timeout=5)
     api.connect(env.service_url)
     api.login(env.username, env.password)
     parsed = urlparse.urlsplit(env.service_url)
     ipaddr = socket.gethostbyname(parsed.netloc)
     with networkblocker.block_ip(ipaddr):
         assert_raises(RavelloError, api.hello)
     assert api._total_retries >= 3
Esempio n. 3
0
 def timed_block(secs):
     with networkblocker.block_ip(ipaddr):
         time.sleep(secs)