コード例 #1
0
 def test_client_saves_id_and_name(self):
     """
     Checks if Client class preserves basic state
     """
     client = Client(self._fake_id, self._fake_name)
     self.assertEqual(self._fake_id, client.get_id())
     self.assertEqual(self._fake_name, client.get_name())
コード例 #2
0
 def test_client_last_access_time(self):
     """
     Checks if Client calculates time since access correctly
     """
     timer = FakeTimer(self._time_increment)
     client = Client(self._fake_id, self._fake_name, timer)
     self.assertEqual(self._time_increment, client.get_time_since_access())
     client.refresh()
     count = 5
     for _ in range(0, count):
         timer()
     self.assertEqual(self._time_increment*(count+1), client.get_time_since_access())