Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Unit Test Example
from src.key_value_store import KeyValueStore
TEST_LOG_PATH = "tests/test_kvs_logs.txt"
class TestKeyValueStore():
...
def test_write_to_log(self):
self.clean_up_file(TEST_LOG_PATH)
kvs = KeyValueStore(server_name="DorianGray")
kvs.write_to_log("set Sibyl cruelty", TEST_LOG_PATH)
self.assert_on_file(path=TEST_LOG_PATH, length=1, lines="0 set Sibyl cruelty")
kvs.write_to_log("Set Basil wrath", TEST_LOG_PATH)
self.assert_on_file(path=TEST_LOG_PATH, length=2, lines=["0 set Sibyl cruelty", "0 set Basil wrath"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.