def test_put_get_remove(self): k, s = "foo", "bar" da.put(k, s, TestDA.username) secrets = da.get(k, TestDA.username) assert secrets[0][2] == s da.remove(secrets[0][0], TestDA.username) secrets = da.get(k, TestDA.username) assert secrets == []
def test_other_user_key(self): da.put("bank", "money", username="******") secret = da.get("bank", username="******") assert secret == []
def test_username_filter(self): da.put("threads", "GIL!", username="******") da.put("threads", "multi", username="******") python_threads = da.get("threads", "python") java_threads = da.get("threads", "java") assert python_threads[0][2] == 'GIL!' and java_threads[0][2] == 'multi'
def test_key_with_dash(self): keys, secret_id = da.put("mid-day", "newspaper?", TestDA.username) assert len(keys) == 3
def test_list_absolute_keys(self): k, s = "Lorem Ipsum", "no more a secret" da.put(k, s, TestDA.username) keys = da.list_absolute_keys(TestDA.username) assert k.lower() in keys
def test_fuzzy_search(self): k, s = "this is my mobile number", "9867111111" da.put(k, s, TestDA.username) secrets = da.get("mobil", TestDA.username) assert secrets[0][2] == s
def test_one_key_many_secrets(self): da.put("knock knock joke", "sure!", TestDA.username) da.put("knock knock", "who is it?", TestDA.username) secrets = da.get('knock', TestDA.username) assert len(secrets) == 2
def test_put_stopword_key(self): k, s = "a", "to z" da.put(k, s, TestDA.username) secrets = da.get(k, TestDA.username) assert secrets[0][2] == s
def keep(secret, key, username): return da.put(key, secret, username)