Skip to content

Commit

Permalink
Remove FromStr usage
Browse files Browse the repository at this point in the history
  • Loading branch information
bschwind committed Mar 29, 2024
1 parent 1279066 commit 66affb7
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions server/src/api/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,7 @@ mod handlers {

#[cfg(test)]
mod tests {
use std::{
str::FromStr,
time::{Duration, SystemTime},
};
use std::time::{Duration, SystemTime};

use super::*;
use crate::{db::DatabaseAssociation, test};
Expand Down Expand Up @@ -509,7 +506,7 @@ mod tests {
.unwrap();
assert_eq!(
developer_1.endpoint,
Some(Endpoint::from_str(test::DEVELOPER1_PEER_ENDPOINT).unwrap())
Some(test::DEVELOPER1_PEER_ENDPOINT.parse().unwrap())
);
assert_eq!(developer_1.candidates, candidates);

Expand Down Expand Up @@ -544,15 +541,12 @@ mod tests {
.unwrap();

// The peer endpoint should be the one we just specified in the override-endpoint request.
assert_eq!(
developer_1.endpoint,
Some(Endpoint::from_str("1.2.3.4:51820").unwrap())
);
assert_eq!(developer_1.endpoint, Some("1.2.3.4:51820".parse().unwrap()));

// The list of candidates should now contain the one we specified at the beginning of the
// test, and the wireguard-reported endpoint of the peer.
let nat_candidate_1 = Endpoint::from_str("1.1.1.1:51820").unwrap();
let nat_candidate_2 = Endpoint::from_str(test::DEVELOPER1_PEER_ENDPOINT).unwrap();
let nat_candidate_1 = "1.1.1.1:51820".parse().unwrap();
let nat_candidate_2 = test::DEVELOPER1_PEER_ENDPOINT.parse().unwrap();
assert_eq!(developer_1.candidates.len(), 2);
assert!(developer_1.candidates.contains(&nat_candidate_1));
assert!(developer_1.candidates.contains(&nat_candidate_2));
Expand Down

0 comments on commit 66affb7

Please sign in to comment.