mirror of https://github.com/mastodon/flodgatt
Add email field to User in tests
This commit is contained in:
parent
2553a75e5e
commit
3cc78974c5
|
@ -414,7 +414,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "flodgatt"
|
||||
version = "0.4.7"
|
||||
version = "0.4.8"
|
||||
dependencies = [
|
||||
"criterion 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dotenv 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
|
@ -179,6 +179,7 @@ mod test {
|
|||
user: User {
|
||||
target_timeline: "public:media".to_string(),
|
||||
id: -1,
|
||||
email: "".to_string(),
|
||||
access_token: "no access token".to_string(),
|
||||
langs: None,
|
||||
scopes: OauthScope {
|
||||
|
@ -196,6 +197,7 @@ mod test {
|
|||
user: User {
|
||||
target_timeline: "public:media".to_string(),
|
||||
id: -1,
|
||||
email: "".to_string(),
|
||||
access_token: "no access token".to_string(),
|
||||
langs: None,
|
||||
scopes: OauthScope {
|
||||
|
@ -213,6 +215,7 @@ mod test {
|
|||
user: User {
|
||||
target_timeline: "public:local".to_string(),
|
||||
id: -1,
|
||||
email: "".to_string(),
|
||||
access_token: "no access token".to_string(),
|
||||
langs: None,
|
||||
scopes: OauthScope {
|
||||
|
@ -230,6 +233,7 @@ mod test {
|
|||
user: User {
|
||||
target_timeline: "public:local:media".to_string(),
|
||||
id: -1,
|
||||
email: "".to_string(),
|
||||
access_token: "no access token".to_string(),
|
||||
langs: None,
|
||||
scopes: OauthScope {
|
||||
|
@ -247,6 +251,7 @@ mod test {
|
|||
user: User {
|
||||
target_timeline: "public:local:media".to_string(),
|
||||
id: -1,
|
||||
email: "".to_string(),
|
||||
access_token: "no access token".to_string(),
|
||||
langs: None,
|
||||
scopes: OauthScope {
|
||||
|
@ -264,6 +269,7 @@ mod test {
|
|||
user: User {
|
||||
target_timeline: "hashtag:a".to_string(),
|
||||
id: -1,
|
||||
email: "".to_string(),
|
||||
access_token: "no access token".to_string(),
|
||||
langs: None,
|
||||
scopes: OauthScope {
|
||||
|
@ -281,6 +287,7 @@ mod test {
|
|||
user: User {
|
||||
target_timeline: "hashtag:local:a".to_string(),
|
||||
id: -1,
|
||||
email: "".to_string(),
|
||||
access_token: "no access token".to_string(),
|
||||
langs: None,
|
||||
scopes: OauthScope {
|
||||
|
@ -299,6 +306,7 @@ mod test {
|
|||
user: User {
|
||||
target_timeline: "1".to_string(),
|
||||
id: 1,
|
||||
email: "user@example.com".to_string(),
|
||||
access_token: "TEST_USER".to_string(),
|
||||
langs: None,
|
||||
scopes: OauthScope {
|
||||
|
@ -316,6 +324,7 @@ mod test {
|
|||
user: User {
|
||||
target_timeline: "1".to_string(),
|
||||
id: 1,
|
||||
email: "user@example.com".to_string(),
|
||||
access_token: "TEST_USER".to_string(),
|
||||
langs: None,
|
||||
scopes: OauthScope {
|
||||
|
@ -333,6 +342,7 @@ mod test {
|
|||
user: User {
|
||||
target_timeline: "direct".to_string(),
|
||||
id: 1,
|
||||
email: "user@example.com".to_string(),
|
||||
access_token: "TEST_USER".to_string(),
|
||||
langs: None,
|
||||
scopes: OauthScope {
|
||||
|
@ -352,6 +362,7 @@ mod test {
|
|||
user: User {
|
||||
target_timeline: "list:1".to_string(),
|
||||
id: 1,
|
||||
email: "user@example.com".to_string(),
|
||||
access_token: "TEST_USER".to_string(),
|
||||
langs: None,
|
||||
scopes: OauthScope {
|
||||
|
|
|
@ -11,10 +11,11 @@ impl PostgresPool {
|
|||
pub fn query_for_user_data(
|
||||
access_token: &str,
|
||||
_pg_pool: PostgresPool,
|
||||
) -> (i64, Option<Vec<String>>, Vec<String>) {
|
||||
let (user_id, lang, scopes) = if access_token == "TEST_USER" {
|
||||
) -> (i64, String, Option<Vec<String>>, Vec<String>) {
|
||||
let (user_id, email, lang, scopes) = if access_token == "TEST_USER" {
|
||||
(
|
||||
1,
|
||||
"user@example.com".to_string(),
|
||||
None,
|
||||
vec![
|
||||
"read".to_string(),
|
||||
|
@ -23,9 +24,9 @@ pub fn query_for_user_data(
|
|||
],
|
||||
)
|
||||
} else {
|
||||
(-1, None, Vec::new())
|
||||
(-1, "".to_string(), None, Vec::new())
|
||||
};
|
||||
(user_id, lang, scopes)
|
||||
(user_id, email, lang, scopes)
|
||||
}
|
||||
|
||||
pub fn query_list_owner(list_id: i64, _pg_pool: PostgresPool) -> Option<i64> {
|
||||
|
|
|
@ -26,7 +26,7 @@ impl Default for Filter {
|
|||
#[derive(Clone, Debug, Default, PartialEq)]
|
||||
pub struct User {
|
||||
pub target_timeline: String,
|
||||
pub email: String,
|
||||
pub email: String, // We only use email for logging; we could cut it for performance
|
||||
pub id: i64,
|
||||
pub access_token: String,
|
||||
pub scopes: OauthScope,
|
||||
|
@ -64,7 +64,7 @@ impl User {
|
|||
None => (
|
||||
-1,
|
||||
"no access token".to_owned(),
|
||||
"no email".to_owned(),
|
||||
"".to_string(),
|
||||
OauthScope::default(),
|
||||
None,
|
||||
false,
|
||||
|
|
|
@ -126,6 +126,7 @@ mod test {
|
|||
user: User {
|
||||
target_timeline: "public:media".to_string(),
|
||||
id: -1,
|
||||
email: "".to_string(),
|
||||
access_token: "no access token".to_string(),
|
||||
langs: None,
|
||||
scopes: OauthScope {
|
||||
|
@ -143,6 +144,7 @@ mod test {
|
|||
user: User {
|
||||
target_timeline: "public:local".to_string(),
|
||||
id: -1,
|
||||
email: "".to_string(),
|
||||
access_token: "no access token".to_string(),
|
||||
langs: None,
|
||||
scopes: OauthScope {
|
||||
|
@ -160,6 +162,7 @@ mod test {
|
|||
user: User {
|
||||
target_timeline: "public:local:media".to_string(),
|
||||
id: -1,
|
||||
email: "".to_string(),
|
||||
access_token: "no access token".to_string(),
|
||||
langs: None,
|
||||
scopes: OauthScope {
|
||||
|
@ -177,6 +180,7 @@ mod test {
|
|||
user: User {
|
||||
target_timeline: "hashtag:a".to_string(),
|
||||
id: -1,
|
||||
email: "".to_string(),
|
||||
access_token: "no access token".to_string(),
|
||||
langs: None,
|
||||
scopes: OauthScope {
|
||||
|
@ -194,6 +198,7 @@ mod test {
|
|||
user: User {
|
||||
target_timeline: "hashtag:local:a".to_string(),
|
||||
id: -1,
|
||||
email: "".to_string(),
|
||||
access_token: "no access token".to_string(),
|
||||
langs: None,
|
||||
scopes: OauthScope {
|
||||
|
@ -212,6 +217,7 @@ mod test {
|
|||
user: User {
|
||||
target_timeline: "1".to_string(),
|
||||
id: 1,
|
||||
email: "user@example.com".to_string(),
|
||||
access_token: "TEST_USER".to_string(),
|
||||
langs: None,
|
||||
scopes: OauthScope {
|
||||
|
@ -229,6 +235,7 @@ mod test {
|
|||
user: User {
|
||||
target_timeline: "1".to_string(),
|
||||
id: 1,
|
||||
email: "user@example.com".to_string(),
|
||||
access_token: "TEST_USER".to_string(),
|
||||
langs: None,
|
||||
scopes: OauthScope {
|
||||
|
@ -246,6 +253,7 @@ mod test {
|
|||
user: User {
|
||||
target_timeline: "direct".to_string(),
|
||||
id: 1,
|
||||
email: "user@example.com".to_string(),
|
||||
access_token: "TEST_USER".to_string(),
|
||||
langs: None,
|
||||
scopes: OauthScope {
|
||||
|
@ -263,6 +271,7 @@ mod test {
|
|||
user: User {
|
||||
target_timeline: "list:1".to_string(),
|
||||
id: 1,
|
||||
email: "user@example.com".to_string(),
|
||||
access_token: "TEST_USER".to_string(),
|
||||
langs: None,
|
||||
scopes: OauthScope {
|
||||
|
|
Loading…
Reference in New Issue