async def test_send_offer_with_bad_connection(): with pytest.raises(VcxError) as e: connection = Connection(source_id) issuer_credential = await IssuerCredential.create(source_id, attrs, cred_def_id, name, price) await issuer_credential.send_offer(connection) assert ErrorCode.InvalidConnectionHandle == e.value.error_code assert 'Invalid Connection Handle' == e.value.error_msg
async def test_send_credential_with_invalid_connection(): with pytest.raises(VcxError) as e: cred_def = await CredentialDef.create(source_id, name, schema_id, 0) issuer_credential = await IssuerCredential.create( source_id, attrs, cred_def.handle, name, price) await issuer_credential.send_credential(Connection(source_id)) assert ErrorCode.InvalidConnectionHandle == e.value.error_code
async def test_serialize_with_bad_handle(): with pytest.raises(VcxError) as e: connection = Connection(source_id) connection.handle = 0 await connection.serialize() assert ErrorCode.InvalidConnectionHandle == e.value.error_code
async def test_call_to_connect_with_bad_handle(): with pytest.raises(VcxError) as e: invalid_connection = Connection(source_id) invalid_connection.handle = 0 await invalid_connection.connect(phone_number) assert ErrorCode.InvalidConnectionHandle == e.value.error_code
async def test_update_state_with_invalid_handle(): with pytest.raises(VcxError) as e: connection = Connection(source_id) connection.handle = 0 await connection.update_state() assert ErrorCode.InvalidConnectionHandle == e.value.error_code
async def test_send_proof_with_bad_connection(): with pytest.raises(VcxError) as e: connection = Connection(source_id) disclosed_proof = await DisclosedProof.create(source_id, request) await disclosed_proof.send_proof(connection) assert ErrorCode.InvalidConnectionHandle == e.value.error_code
async def test_send_credential_with_invalid_issuer_credential(): with pytest.raises(VcxError) as e: issuer_credential = IssuerCredential(source_id, attrs, cred_def_id, name, price) await issuer_credential.send_credential(Connection(source_id)) assert ErrorCode.InvalidIssuerCredentialHandle == e.value.error_code
async def test_send_request_with_bad_connection(): with pytest.raises(VcxError) as e: connection = Connection(source_id) credential = await Credential.create(source_id, offer) await credential.send_request(connection, 0) assert ErrorCode.InvalidConnectionHandle == e.value.error_code
async def test_call_to_connect_with_bad_handle(): with pytest.raises(VcxError) as e: invalid_connection = Connection(source_id) invalid_connection.handle = 0 await invalid_connection.connect(connection_options) assert ErrorCode.InvalidConnectionHandle == e.value.error_code