def test_get_item_02(signed_in_op: OP, expected_data): # get item nok7367v4vbsfgg2fczwu4ei44 item_uuid = "nok7367v4vbsfgg2fczwu4ei44" expected = _lookup_item_data(expected_data, item_uuid) result = signed_in_op.get_item(item_uuid) assert result.username == expected["username"] assert result.password == expected["password"]
def test_admin_user_01(signed_in_op: OP, expected_data): # get item "Example Login 1" --vault "Test Data" server_name = "Example Server" vault = "Test Data" expected = _lookup_item_data(expected_data, server_name) result: OPServerItem = signed_in_op.get_item(server_name, vault=vault) assert result.username == expected["username"]
def test_get_item_03(signed_in_op: OP, expected_data): # get item "Example Login" --vault Archive item_name = "Example Login" vault = "Archive" expected = _lookup_item_data(expected_data, item_name) result: OPLoginItem = signed_in_op.get_item(item_name, vault=vault) assert result.username == expected["username"] assert result.password == expected["password"]
def test_get_item_01(signed_in_op: OP, expected_data): # get item "Example Login 1" --vault "Test Data" item_name = "Example Login 1" vault = "Test Data" expected = _lookup_item_data(expected_data, item_name) result = signed_in_op.get_item(item_name, vault=vault) assert result.username == expected["username"] assert result.password == expected["password"]
def test_get_invalid_item_01(signed_in_op: OP, expected_data): item_name = "Invalid Item" expected = _lookup_item_data(expected_data, item_name) try: _ = signed_in_op.get_item(item_name) assert False, "We should have caught an exception" except OPGetItemException as e: print(e) assert e.returncode == expected["returncode"]
def test_ssh_priv_key_01(signed_in_op: OP, expected_data): server_name = "Example Server" vault = "Test Data" keyname = "id_ed25519" expected_key_data = _lookup_ssh_key_data(expected_data, server_name, keyname) server_item: OPServerItem = signed_in_op.get_item(server_name, vault=vault) priv_key = server_item.field_value_by_section_title("SSH Keys", keyname) priv_key_digest = digest(priv_key.encode("utf-8")) assert priv_key_digest == expected_key_data["privkey_digest"]
def test_ssh_key_passphrase_01(signed_in_op: OP, expected_data): server_name = "Example Server" vault = "Test Data" keyname = "id_ed25519" passphrase_field = f"{keyname} passphrase" expected_key_data = _lookup_ssh_key_data(expected_data, server_name, keyname) server_item: OPServerItem = signed_in_op.get_item(server_name, vault=vault) passphrase = server_item.field_value_by_section_title( "SSH Keys", passphrase_field) assert passphrase == expected_key_data["passphrase"]
def test_admin_password_01(signed_in_op: OP, expected_data): server_name = "Example Server" vault = "Test Data" expected = _lookup_item_data(expected_data, server_name) result: OPServerItem = signed_in_op.get_item(server_name, vault=vault) assert result.password == expected["password"]