Last active
December 24, 2019 15:07
-
-
Save chelseatroy/96754ce15247b23267d7386a68172fe4 to your computer and use it in GitHub Desktop.
Unit Test Example
This file contains hidden or 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
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