Fixed mixnet contract test fixtures

This commit is contained in:
Jędrzej Stuczyński
2021-06-23 12:46:38 +01:00
parent 1d4026ec71
commit 07f2f9c39e
3 changed files with 12 additions and 15 deletions
-7
View File
@@ -39,13 +39,6 @@ impl Gateway {
version,
}
}
// pub fn try_resolve_hostname(&self) -> Result<SocketAddr, io::Error> {
// self.mix_host
// .to_socket_addrs()?
// .next()
// .ok_or_else(|| io::Error::new(io::ErrorKind::Other, "no valid socket address"))
// }
}
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize, JsonSchema)]
+8 -4
View File
@@ -107,6 +107,7 @@ pub mod helpers {
pub fn mix_node_fixture() -> MixNode {
MixNode::new(
"mix.node.org".to_string(),
1789,
1,
"Sweden".to_string(),
"sphinx".to_string(),
@@ -118,6 +119,7 @@ pub mod helpers {
pub fn mixnode_bond_fixture() -> MixNodeBond {
let mix_node = MixNode::new(
"1.1.1.1".to_string(),
1789,
1,
"London".to_string(),
"1234".to_string(),
@@ -129,8 +131,9 @@ pub mod helpers {
pub fn gateway_fixture() -> Gateway {
Gateway::new(
"1.1.1.1:1234".to_string(),
"ws://1.1.1.1:1235".to_string(),
"1.1.1.1".to_string(),
1789,
9000,
"Sweden".to_string(),
"sphinx".to_string(),
"identity".to_string(),
@@ -140,8 +143,9 @@ pub mod helpers {
pub fn gateway_bond_fixture() -> GatewayBond {
let gateway = Gateway::new(
"1.1.1.1:1234".to_string(),
"ws://1.1.1.1:1235".to_string(),
"1.1.1.1".to_string(),
1789,
9000,
"London".to_string(),
"sphinx".to_string(),
"identity".to_string(),
+4 -4
View File
@@ -1210,7 +1210,7 @@ pub mod tests {
let msg = ExecuteMsg::BondGateway {
gateway: Gateway {
identity_key: "myAwesomeGateway".to_string(),
mix_host: "1.1.1.1:1789".into(),
host: "1.1.1.1".into(),
..helpers::gateway_fixture()
},
};
@@ -1221,7 +1221,7 @@ pub mod tests {
let msg = ExecuteMsg::BondGateway {
gateway: Gateway {
identity_key: "myAwesomeGateway".to_string(),
mix_host: "2.2.2.2:1789".into(),
host: "2.2.2.2".into(),
..helpers::gateway_fixture()
},
};
@@ -1230,12 +1230,12 @@ pub mod tests {
// make sure the host information was updated
assert_eq!(
"2.2.2.2:1789".to_string(),
"2.2.2.2".to_string(),
gateways_read(deps.as_ref().storage)
.load("myAwesomeGateway".as_bytes())
.unwrap()
.gateway
.mix_host
.host
);
}