Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
Signed-off-by: Patrik Stas <patrik.stas@absa.africa>
  • Loading branch information
Patrik-Stas committed Oct 16, 2020
1 parent 4644155 commit ae90cf3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
8 changes: 4 additions & 4 deletions libvcx/src/api/credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -906,11 +906,11 @@ mod tests {
fn test_vcx_credential_get_new_offers() {
let _setup = SetupAriesMocks::init();

let cxn = ::connection::tests::build_test_connection_inviter_invited();
let handle_conn = ::connection::tests::build_test_connection_invitee_completed();

let cb = return_types_u32::Return_U32_STR::new().unwrap();
assert_eq!(vcx_credential_get_offers(cb.command_handle,
cxn,
handle_conn,
Some(cb.get_callback())),
error::SUCCESS.code_num as u32);
cb.receive(TimeoutUtils::some_medium()).unwrap();
Expand All @@ -921,12 +921,12 @@ mod tests {
fn test_vcx_credential_create() {
let _setup = SetupAriesMocks::init();

let cxn = ::connection::tests::build_test_connection_inviter_invited();
let handle_conn = ::connection::tests::build_test_connection_invitee_completed();

let cb = return_types_u32::Return_U32_U32_STR::new().unwrap();
assert_eq!(vcx_credential_create_with_msgid(cb.command_handle,
CString::new("test_vcx_credential_create").unwrap().into_raw(),
cxn,
handle_conn,
CString::new("123").unwrap().into_raw(),
Some(cb.get_callback())), error::SUCCESS.code_num);
cb.receive(TimeoutUtils::some_medium()).unwrap();
Expand Down
6 changes: 4 additions & 2 deletions libvcx/src/api/issuer_credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ pub mod tests {
fn test_vcx_issuer_update_state_v2() {
let _setup = SetupStrictAriesMocks::init();

let connection_handle = ::connection::tests::build_test_connection_inviter_requested();
let connection_handle = ::connection::tests::build_test_connection_invitee_completed();
let handle = _vcx_issuer_create_credential_c_closure().unwrap();
let cb = return_types_u32::Return_U32::new().unwrap();

Expand All @@ -996,9 +996,11 @@ pub mod tests {

cb.receive(TimeoutUtils::some_medium()).unwrap();

let connection_serialized = ::connection::to_string(connection_handle).unwrap();
::connection::release(connection_handle).unwrap();
let connection_handle = ::connection::from_string(&connection_serialized).unwrap();


let connection_handle = ::connection::tests::build_test_connection_inviter_invited();
let cb = return_types_u32::Return_U32_U32::new().unwrap();

AgencyMockDecrypted::set_next_decrypted_response(GET_MESSAGES_DECRYPTED_RESPONSE);
Expand Down
5 changes: 5 additions & 0 deletions libvcx/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@ pub mod tests {
handle
}

pub fn build_test_connection_invitee_completed() -> u32 {
let handle = from_string(CONNECTION_SM_INVITEE_COMPLETED).unwrap();
handle
}

pub fn build_test_connection_inviter_requested() -> u32 {
let handle = build_test_connection_inviter_invited();
let msg: A2AMessage = serde_json::from_str(ARIES_CONNECTION_REQUEST).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion libvcx/src/credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ pub mod tests {
fn test_get_credential_offer() {
let _setup = SetupAriesMocks::init();

let connection_h = connection::tests::build_test_connection_inviter_invited();
let connection_h = connection::tests::build_test_connection_invitee_completed();

let offer = get_credential_offer_messages(connection_h).unwrap();
let o: serde_json::Value = serde_json::from_str(&offer).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion libvcx/src/disclosed_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ mod tests {
let _setup = SetupAriesMocks::init();
::settings::set_config_value(::settings::CONFIG_PROTOCOL_TYPE, "4.0");

let connection_h = connection::tests::build_test_connection_inviter_invited();
let connection_h = connection::tests::build_test_connection_invitee_completed();

let request = get_proof_request(connection_h, "123").unwrap();
let _request: PresentationRequest = serde_json::from_str(&request).unwrap();
Expand Down

0 comments on commit ae90cf3

Please sign in to comment.