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)
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)
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)
def test_should_try_online(self): state = ClientState() self.assertEquals(state.should_try(), True)