Beispiel #1
0
def test_delete_element():
    json = {"One": 1, "Two": 2}
    jm = JSONManager(json)
    x = jm.delete_entry("Two")
    assert x == {"One": True}
Beispiel #2
0
def test_delete_from_empty_json():
    json = {}
    jm = JSONManager(json)
    with pytest.raises(KeyError):
        x = jm.delete_entry("Two")
Beispiel #3
0
def test_delete_last_element():
    json = {"One": 1}
    jm = JSONManager(json)
    x = jm.delete_entry("One")
    assert x == {}
Beispiel #4
0
def test_delete_element_does_not_exist():
    json = {"One": 1}
    jm = JSONManager(json)
    with pytest.raises(KeyError):
        x = jm.delete_entry("Two")
 def del_id(self, id):
     jm = JSONManager(json.loads(str(self.gpg.decrypt_content())))
     jkv = json.dumps(jm.delete_entry(id))
     self.gpg.encrypt_content(jkv)