def get(self): response = cache.status_message() cache_keys = cache.keys("") if cache_keys: response += "<br>Cached keys:<br>" response += "<br>".join(cache_keys) else: response += "<br>There are no cached keys" self.write(response)
def test_status_exception_connection(self, ping): response = status_message() expected = "Redis connection authenticated [:None] | FAILED | localhost:6379 | Traceback (most recent call last)" self.assertIn(expected, response)
def test_status_fail(self, mock_get_usage_message, mock_ping): response = status_message() expected = 'Redis connection authenticated [:None] | FAILED | localhost:6379 | Ping failed' self.assertEqual(response, expected)
def test_status_success(self, ping): response = status_message() expected = 'Redis connection authenticated' self.assertIn(expected, response)