aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-02-01 17:59:09 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-02-05 17:10:11 -0800
commitad0d781a2f56ac14d3484f7f253c975eb4b3b7fb (patch)
tree5b4098c1b0ad40315729c9230772d5478ae3515a
parent52710c17965147dc5ce6fc719dce6754074a5922 (diff)
downloadfatcat-ad0d781a2f56ac14d3484f7f253c975eb4b3b7fb.tar.gz
fatcat-ad0d781a2f56ac14d3484f7f253c975eb4b3b7fb.zip
remove test client helper
-rw-r--r--rust/tests/helpers.rs36
1 files changed, 0 insertions, 36 deletions
diff --git a/rust/tests/helpers.rs b/rust/tests/helpers.rs
index f4cd93e9..4a664403 100644
--- a/rust/tests/helpers.rs
+++ b/rust/tests/helpers.rs
@@ -14,42 +14,6 @@ use std::str::FromStr;
pub static TEST_ADMIN_EDITOR_ID: &str = "aaaaaaaaaaaabkvkaaaaaaaaae";
//static TEST_ADMIN_EDITOR_ID: FatcatId = FatcatId::from_str("aaaaaaaaaaaabkvkaaaaaaaaae").unwrap();
-// A current problem with this method is that if the test fails (eg, panics, assert fails), the
-// server never gets closed, and the server thread hangs forever.
-// One workaround might be to invert the function, take a closure, capture the panic/failure, and
-// cleanup.
-#[allow(dead_code)]
-pub fn setup_client() -> (Client, Context, Listening) {
- let server = server::create_test_server().unwrap();
-
- // setup auth as admin user
- let admin_id = FatcatId::from_str(TEST_ADMIN_EDITOR_ID).unwrap();
- let token = server
- .auth_confectionary
- .create_token(admin_id, None)
- .unwrap();
- let client_context = Context {
- x_span_id: None,
- authorization: None,
- auth_data: Some(swagger::auth::AuthData::ApiKey(token)),
- };
-
- let router = fatcat_api_spec::router(server);
- let mut chain = Chain::new(router);
- chain.link_before(fatcat_api_spec::server::ExtractAuthData);
- chain.link_before(MacaroonAuthMiddleware::new());
-
- let mut iron_server = Iron::new(chain);
- iron_server.threads = 1;
- // XXX: this isn't supposed to block, but it is. Disabling these tests for now.
- let iron_server = iron_server
- .http("localhost:9300")
- .expect("Failed to start HTTP server");
-
- let client = Client::try_new_http("http://localhost:9144").unwrap();
- (client, client_context, iron_server)
-}
-
#[allow(dead_code)]
pub fn setup_http() -> (
Headers,