Skip to content

Commit

Permalink
Updates: auth setting names to be same as on the device.
Browse files Browse the repository at this point in the history
  • Loading branch information
korvyashka committed Sep 5, 2024
1 parent 9529939 commit f1f7583
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
6 changes: 3 additions & 3 deletions docs/EdgeApps.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,11 @@ The `auth` field is optional and is used to configure Edge App authentication. I
- **global:** A boolean value that determines whether the authentication is global (`true`) or local (`false`).

For Basic authentication, the following settings are generated:
- `screenly_basic_auth_username`
- `screenly_basic_auth_password`
- `screenly_http_basic_auth_username`
- `screenly_http_basic_auth_password`

For Bearer authentication, the following setting is generated:
- `screenly_bearer_token`
- `screenly_http_bearer_token`

These settings must be configured using the `screenly edge-app setting set` command.

Expand Down
12 changes: 6 additions & 6 deletions src/commands/edge_app/manifest_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ impl AuthType {
Setting::new(
SettingType::String,
"Username",
"screenly_basic_auth_username",
"screenly_http_basic_auth_username",
"The username for Basic Authentication.",
global,
),
Setting::new(
SettingType::Secret,
"Password",
"screenly_basic_auth_password",
"screenly_http_basic_auth_password",
"The password for Basic Authentication.",
global,
),
],
AuthType::Bearer => vec![Setting::new(
SettingType::String,
"Token",
"screenly_bearer_token",
"screenly_http_bearer_token",
"The Bearer token for authentication.",
global,
)],
Expand All @@ -52,7 +52,7 @@ mod tests {

let username_setting = &settings[0];
assert_eq!(username_setting.type_, SettingType::String);
assert_eq!(username_setting.name, "screenly_basic_auth_username");
assert_eq!(username_setting.name, "screenly_http_basic_auth_username");
assert_eq!(username_setting.title, Some("Username".to_string()));
assert!(!username_setting.optional);
assert!(username_setting
Expand All @@ -61,7 +61,7 @@ mod tests {

let password_setting = &settings[1];
assert_eq!(password_setting.type_, SettingType::Secret);
assert_eq!(password_setting.name, "screenly_basic_auth_password");
assert_eq!(password_setting.name, "screenly_http_basic_auth_password");
assert_eq!(password_setting.title, Some("Password".to_string()));
assert!(!password_setting.optional);
assert!(password_setting
Expand All @@ -78,7 +78,7 @@ mod tests {

let token_setting = &settings[0];
assert_eq!(token_setting.type_, SettingType::String);
assert_eq!(token_setting.name, "screenly_bearer_token");
assert_eq!(token_setting.name, "screenly_http_bearer_token");
assert_eq!(token_setting.title, Some("Token".to_string()));
assert!(!token_setting.optional);
assert!(token_setting
Expand Down
28 changes: 14 additions & 14 deletions src/commands/edge_app/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -740,11 +740,11 @@ mod tests {
assert!(changes
.creates
.iter()
.any(|s| s.name == "screenly_basic_auth_username" && !s.is_global));
.any(|s| s.name == "screenly_http_basic_auth_username" && !s.is_global));
assert!(changes
.creates
.iter()
.any(|s| s.name == "screenly_basic_auth_password" && !s.is_global));
.any(|s| s.name == "screenly_http_basic_auth_password" && !s.is_global));
}

#[test]
Expand All @@ -765,7 +765,7 @@ mod tests {
assert!(result.is_ok());
let changes = result.unwrap();
assert_eq!(changes.creates.len(), 1);
assert_eq!(changes.creates[0].name, "screenly_bearer_token");
assert_eq!(changes.creates[0].name, "screenly_http_bearer_token");
assert!(!changes.creates[0].is_global);
}

Expand All @@ -783,14 +783,14 @@ mod tests {
Setting::new(
SettingType::String,
"Username",
"screenly_basic_auth_username",
"screenly_http_basic_auth_username",
"Basic auth username",
false,
),
Setting::new(
SettingType::Secret,
"Password",
"screenly_basic_auth_password",
"screenly_http_basic_auth_password",
"Basic auth password",
false,
),
Expand All @@ -803,17 +803,17 @@ mod tests {
assert!(result.is_ok());
let changes = result.unwrap();
assert_eq!(changes.creates.len(), 1);
assert_eq!(changes.creates[0].name, "screenly_bearer_token");
assert_eq!(changes.creates[0].name, "screenly_http_bearer_token");
assert!(!changes.creates[0].is_global);
assert_eq!(changes.deleted.len(), 2);
assert!(changes
.deleted
.iter()
.any(|s| s.name == "screenly_basic_auth_username"));
.any(|s| s.name == "screenly_http_basic_auth_username"));
assert!(changes
.deleted
.iter()
.any(|s| s.name == "screenly_basic_auth_password"));
.any(|s| s.name == "screenly_http_basic_auth_password"));
}

#[test]
Expand All @@ -829,7 +829,7 @@ mod tests {
remote_settings.push(Setting::new(
SettingType::String,
"Token",
"screenly_bearer_token",
"screenly_http_bearer_token",
"Bearer token",
false,
));
Expand All @@ -844,13 +844,13 @@ mod tests {
assert!(changes
.creates
.iter()
.any(|s| s.name == "screenly_basic_auth_username" && !s.is_global));
.any(|s| s.name == "screenly_http_basic_auth_username" && !s.is_global));
assert!(changes
.creates
.iter()
.any(|s| s.name == "screenly_basic_auth_password" && !s.is_global));
.any(|s| s.name == "screenly_http_basic_auth_password" && !s.is_global));
assert_eq!(changes.deleted.len(), 1);
assert_eq!(changes.deleted[0].name, "screenly_bearer_token");
assert_eq!(changes.deleted[0].name, "screenly_http_bearer_token");
}

#[test]
Expand All @@ -874,11 +874,11 @@ mod tests {
assert!(changes
.creates
.iter()
.any(|s| s.name == "screenly_basic_auth_username" && s.is_global));
.any(|s| s.name == "screenly_http_basic_auth_username" && s.is_global));
assert!(changes
.creates
.iter()
.any(|s| s.name == "screenly_basic_auth_password" && s.is_global));
.any(|s| s.name == "screenly_http_basic_auth_password" && s.is_global));
}

#[test]
Expand Down

0 comments on commit f1f7583

Please sign in to comment.