Skip to content

Commit

Permalink
refactor: remove unnecessary test
Browse files Browse the repository at this point in the history
connection is already tested in aries-connection test file

Signed-off-by: Naian <[email protected]>
  • Loading branch information
nain-F49FF806 committed Nov 1, 2023
1 parent 4c74c47 commit 82bae34
Showing 1 changed file with 3 additions and 55 deletions.
58 changes: 3 additions & 55 deletions agents/rust/mediator/tests/mediator-coord-protocol.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
mod common;
use std::collections::VecDeque;

use aries_vcx::protocols::connection::invitee::{states::completed::Completed, InviteeConnection};
use aries_vcx_core::wallet::base_wallet::BaseWallet;
use mediation::{
didcomm_types::mediator_coord_structs::{
KeylistData, KeylistQueryData, KeylistUpdateItem, KeylistUpdateItemAction,
KeylistUpdateRequestData, MediatorCoordMsgEnum,
},
storage::MediatorPersistence,
};
use mediator::aries_agent::{
client::transports::{AriesReqwest, AriesTransport},
Agent,
use mediation::didcomm_types::mediator_coord_structs::{
KeylistData, KeylistQueryData, KeylistUpdateItem, KeylistUpdateItemAction,
KeylistUpdateRequestData, MediatorCoordMsgEnum,
};
use messages::msg_fields::protocols::out_of_band::invitation::Invitation as OOBInvitation;
use reqwest::header::ACCEPT;

use crate::common::{
agent_and_transport_utils::{
Expand All @@ -27,47 +16,6 @@ use crate::common::{

static LOGGING_INIT: std::sync::Once = std::sync::Once::new();

const ENDPOINT_ROOT: &str = "http://localhost:8005";

async fn didcomm_connection(
agent: &Agent<impl BaseWallet + 'static, impl MediatorPersistence>,
aries_transport: &mut impl AriesTransport,
) -> Result<InviteeConnection<Completed>> {
let client = reqwest::Client::new();
let base: Url = ENDPOINT_ROOT.parse().unwrap();
let endpoint_register = base.join("register").unwrap();

let oobi: OOBInvitation = client
.get(endpoint_register)
.header(ACCEPT, "application/json")
.send()
.await?
.error_for_status()?
.json()
.await?;
info!("Got invitation from register endpoint {:?}", oobi);

let state: InviteeConnection<Completed> =
agent.establish_connection(oobi, aries_transport).await?;

Ok(state)
}

#[tokio::test]
#[ignore]
async fn test_init() {
LOGGING_INIT.call_once(setup_env_logging);
let agent = mediator::aries_agent::AgentBuilder::new_demo_agent()
.await
.unwrap();
let mut aries_transport = AriesReqwest {
response_queue: VecDeque::new(),
client: reqwest::Client::new(),
};
let _ = didcomm_connection(&agent, &mut aries_transport).await;
let _ = didcomm_connection(&agent, &mut aries_transport).await;
}

#[tokio::test]
async fn test_mediate_grant() -> Result<()> {
LOGGING_INIT.call_once(setup_env_logging);
Expand Down

0 comments on commit 82bae34

Please sign in to comment.