mirror of
https://github.com/nitnelave/lldap.git
synced 2023-04-12 14:25:13 +00:00
clippy feedback
This commit is contained in:
parent
c22042c2c1
commit
30e5805d5c
@ -10,8 +10,8 @@ pub fn get_token(client: &Client) -> String {
|
||||
.header(reqwest::header::CONTENT_TYPE, "application/json")
|
||||
.body(
|
||||
serde_json::to_string(&lldap_auth::login::ClientSimpleLoginRequest {
|
||||
username: username,
|
||||
password: password,
|
||||
username,
|
||||
password,
|
||||
})
|
||||
.expect("Failed to encode the username/password as json to log in"),
|
||||
)
|
||||
|
@ -5,7 +5,7 @@ pub const DB_KEY: &str = "LLDAP_DATABASE_URL";
|
||||
pub fn database_url() -> String {
|
||||
let url = var(DB_KEY).ok();
|
||||
let url = url.unwrap_or("sqlite://e2e_test.db?mode=rwc".to_string());
|
||||
url.to_string()
|
||||
url
|
||||
}
|
||||
|
||||
pub fn ldap_url() -> String {
|
||||
@ -27,17 +27,17 @@ pub fn http_url() -> String {
|
||||
pub fn admin_dn() -> String {
|
||||
let user = var("LLDAP_LDAP_USER_DN").ok();
|
||||
let user = user.unwrap_or("admin".to_string());
|
||||
user.to_string()
|
||||
user
|
||||
}
|
||||
|
||||
pub fn admin_password() -> String {
|
||||
let pass = var("LLDAP_LDAP_USER_PASS").ok();
|
||||
let pass = pass.unwrap_or("password".to_string());
|
||||
pass.to_string()
|
||||
pass
|
||||
}
|
||||
|
||||
pub fn base_dn() -> String {
|
||||
let dn = var("LLDAP_LDAP_BASE_DN").ok();
|
||||
let dn = dn.unwrap_or("dc=example,dc=com".to_string());
|
||||
dn.to_string()
|
||||
dn
|
||||
}
|
||||
|
@ -110,18 +110,18 @@ impl LLDAPFixture {
|
||||
self.users.insert(user.clone());
|
||||
}
|
||||
|
||||
fn add_group(&mut self, group: &String) {
|
||||
fn add_group(&mut self, group: &str) {
|
||||
let id = post::<CreateGroup>(
|
||||
&self.client,
|
||||
&self.token,
|
||||
create_group::Variables {
|
||||
name: group.clone(),
|
||||
name: group.to_owned(),
|
||||
},
|
||||
)
|
||||
.expect("failed to add group")
|
||||
.create_group
|
||||
.id;
|
||||
self.groups.insert(group.clone(), id);
|
||||
self.groups.insert(group.to_owned(), id);
|
||||
}
|
||||
|
||||
fn delete_user(&mut self, user: &String) {
|
||||
@ -147,13 +147,13 @@ impl LLDAPFixture {
|
||||
self.groups.remove(group);
|
||||
}
|
||||
|
||||
fn add_user_to_group(&mut self, user: &String, group: &String) {
|
||||
fn add_user_to_group(&mut self, user: &str, group: &String) {
|
||||
let group_id = self.groups.get(group).unwrap();
|
||||
post::<AddUserToGroup>(
|
||||
&self.client,
|
||||
&self.token,
|
||||
add_user_to_group::Variables {
|
||||
user: user.clone(),
|
||||
user: user.to_owned(),
|
||||
group: *group_id,
|
||||
},
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user