-
-
Save giornaledisistema/856622d7929581d1ec41 to your computer and use it in GitHub Desktop.
unittest cache server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
import cache_server | |
import time | |
TEST_KEY = "test_key" | |
TEST_VALUE = "test_value" | |
TEST_DATA = {TEST_KEY: {"value": TEST_VALUE, | |
"creation_time": time.time(), | |
"timeout": 60, | |
}, | |
} | |
class CacheServerTest(unittest.TestCase): | |
def setUp(self): | |
self.app = cache_server.CacheServer() | |
def test_get_returned_value(self): | |
self.app.cached_values = TEST_DATA | |
self.assertEqual(TEST_VALUE, self.app.get(TEST_KEY)) | |
def test_delete_key(self): | |
self.app.cached_values = TEST_DATA | |
self.assertEqual(None, self.app.delete(TEST_KEY)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment