Exemple #1
0
 def test_should_try_retry_after_passed(self):
     state = ClientState()
     state.status = state.ERROR
     state.last_check = time.time() - 1
     state.retry_number = 1
     state.retry_after = 1
     self.assertTrue(state.should_try())
Exemple #2
0
 def test_set_success(self):
     state = ClientState()
     state.status = state.ERROR
     state.last_check = 'foo'
     state.retry_number = 0
     state.set_success()
     self.assertEquals(state.status, state.ONLINE)
     self.assertEquals(state.last_check, None)
     self.assertEquals(state.retry_number, 0)
Exemple #3
0
 def test_should_try_retry_after_passed(self):
     state = ClientState()
     state.status = state.ERROR
     state.last_check = time.time() - 1
     state.retry_number = 1
     state.retry_after = 1
     self.assertTrue(state.should_try())
Exemple #4
0
 def test_set_success(self):
     state = ClientState()
     state.status = state.ERROR
     state.last_check = "foo"
     state.retry_number = 0
     state.set_success()
     self.assertEquals(state.status, state.ONLINE)
     self.assertEquals(state.last_check, None)
     self.assertEquals(state.retry_number, 0)
Exemple #5
0
 def test_set_fail(self):
     state = ClientState()
     state.set_fail()
     self.assertEquals(state.status, state.ERROR)
     self.assertNotEquals(state.last_check, None)
     self.assertEquals(state.retry_number, 1)
Exemple #6
0
 def test_should_try_time_passed_error(self):
     state = ClientState()
     state.status = state.ERROR
     state.last_check = time.time() - 10
     state.retry_number = 1
     self.assertEquals(state.should_try(), True)
Exemple #7
0
 def test_should_try_online(self):
     state = ClientState()
     self.assertEquals(state.should_try(), True)
Exemple #8
0
 def test_set_fail(self):
     state = ClientState()
     state.set_fail()
     self.assertEquals(state.status, state.ERROR)
     self.assertNotEquals(state.last_check, None)
     self.assertEquals(state.retry_number, 1)
Exemple #9
0
 def test_should_try_time_passed_error(self):
     state = ClientState()
     state.status = state.ERROR
     state.last_check = time.time() - 10
     state.retry_number = 1
     self.assertEquals(state.should_try(), True)
Exemple #10
0
 def test_should_try_online(self):
     state = ClientState()
     self.assertEquals(state.should_try(), True)