Ejemplo n.º 1
0
 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 == []
Ejemplo n.º 2
0
 def test_other_user_key(self):
     da.put("bank", "money", username="******")
     secret = da.get("bank", username="******")
     assert secret == []
Ejemplo n.º 3
0
 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'
Ejemplo n.º 4
0
 def test_key_with_dash(self):
     keys, secret_id = da.put("mid-day", "newspaper?", TestDA.username)
     assert len(keys) == 3
Ejemplo n.º 5
0
 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
Ejemplo n.º 6
0
 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
Ejemplo n.º 7
0
 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
Ejemplo n.º 8
0
 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
Ejemplo n.º 9
0
def keep(secret, key, username):
    return da.put(key, secret, username)