def test_cache_is_cleared(self):
        unit_system = random.randint(1, 10)
        SUT = RecordCache(unit_system)

        key = ''.join([random.choice(string.ascii_letters + string.digits) for n in range(32)])
        value = round(random.uniform(1, 100), 2)
        timestamp = time.time()
        SUT.update_value(key, value, unit_system, timestamp)

        SUT.clear_cache()
        self.assertEqual(SUT.cached_values, {})
Exemple #2
0
    def test_cache_is_cleared(self):
        unit_system = random.randint(1, 10)
        SUT = RecordCache()

        key = random_string()
        value = round(random.uniform(1, 100), 2)
        timestamp = time.time()
        SUT.update_value(key, value, unit_system, timestamp)

        SUT.clear_cache()
        self.assertEqual(SUT.cached_values, {})