def test_status_message_five_keys_cache_hit_once(self): def _side_effect(*args, **kwargs): no_argument = {"keyspace_hits": "1", "keyspace_misses": "9"} no_argument.update(self.STANDARD_INFO_KEYS) return {"db0": {"keys": 5}} if args else no_argument with patch("brainiak.utils.cache.redis_client.info", side_effect=_side_effect): expected_in_status_msg = "Number of keys: 5 | Hit ratio: 0.1" usage_message = get_usage_message() self.assertIn(expected_in_status_msg, usage_message)