Skip to content

Commit

Permalink
test(connection): remove basic auth and implement jwt auth test
Browse files Browse the repository at this point in the history
  • Loading branch information
fMeow committed Oct 25, 2018
1 parent 5a600f5 commit b62d4c9
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/connection/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,25 @@ use std::collections::HashMap;

use log::{debug, info};
use pretty_assertions::{assert_eq, assert_ne};
use reqwest::Url;
use reqwest::{Url, header::AUTHORIZATION};

use super::Connection;

const URL: &str = "http://localhost:8529";
const USERNAME: &str = "root";
const PASSWORD: &str = "KWNngteTps7XjrNv";

#[test]
fn test_setup() {
env_logger::init();
}
#[test]
fn test_basic_auth() {
// let _ = pretty_env_logger::try_init();
let conn = Connection::establish_basic_auth(URL, "root", "KWNngteTps7XjrNv").unwrap();
let session = conn.get_session();
let headers = session.get(URL).build().unwrap().headers();
// let basic = headers.get::<Basic>().unwrap();
}

#[test]
fn test_jwt_auth() {
// let _ = pretty_env_logger::try_init();
let conn: Connection = Default::default();
let jwt = conn.jwt_login("root", "KWNngteTps7XjrNv").unwrap();
info!("JWT login success. Token: {}", jwt);
// assert_eq!(false, true);
let not_empty = jwt.len() > 1;
assert_eq!(not_empty, true);
}

0 comments on commit b62d4c9

Please sign in to comment.