def test_delete_element(): json = {"One": 1, "Two": 2} jm = JSONManager(json) x = jm.delete_entry("Two") assert x == {"One": True}
def test_delete_from_empty_json(): json = {} jm = JSONManager(json) with pytest.raises(KeyError): x = jm.delete_entry("Two")
def test_delete_last_element(): json = {"One": 1} jm = JSONManager(json) x = jm.delete_entry("One") assert x == {}
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)