Compare commits
8 Commits
v0.4.1-dev
...
v0.4.3
Author | SHA1 | Date | |
---|---|---|---|
6aa4c3d741 | |||
47475639b0 | |||
73c17840ff | |||
97853a42c1 | |||
fdae8056b1 | |||
24aa60cb48 | |||
d8eadb8187 | |||
2b2e96c02d |
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "icarus_models"
|
name = "icarus_models"
|
||||||
version = "0.4.1"
|
version = "0.4.3"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.86"
|
rust-version = "1.86"
|
||||||
description = "models used for the icarus project"
|
description = "models used for the icarus project"
|
||||||
|
29
src/token.rs
29
src/token.rs
@@ -57,14 +57,27 @@ impl Token {
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Implement
|
|
||||||
pub fn contains_scope(&self, des_scope: &String) -> bool {
|
pub fn contains_scope(&self, des_scope: &String) -> bool {
|
||||||
let extracted_token: String = String::from("Token");
|
self.scope.contains(des_scope)
|
||||||
|
}
|
||||||
if extracted_token == *des_scope {
|
}
|
||||||
return true;
|
|
||||||
}
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
false
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_token_scope_check() {
|
||||||
|
let mut token = Token::default();
|
||||||
|
token.scope = String::from("song:read song:upload song:download");
|
||||||
|
|
||||||
|
let check_scope = String::from("song:download");
|
||||||
|
let result = token.contains_scope(&check_scope);
|
||||||
|
|
||||||
|
assert!(
|
||||||
|
result,
|
||||||
|
"Error: The scope {:?} was not found in the token's scope {:?}",
|
||||||
|
check_scope, token.scope
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user