mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-04-25 07:07:32 -04:00
* chore: update client-api rev * chore: update collab rev id * feat: add sign_in_request and import shared entity * feat: added to userworkspace from af_workspace * chore: add script to update the client-api rev id * chore: update client-api rev * feat: add workspaces api * feat: added check user * chore: config * chore: update client_api version * chore: ws connect * chore: ws connect * chore: update crate versions * chore: rename event * chore: update client-appi * chore: set appflowy cloud env * chore: add env template * chore: update env name * docs: update docs * fix: check_user * feat: impl sign_in_with_url * feat: add file storage placeholders * chore: update client-api * chore: disable test * feat: impl workspace add and remove * chore: sign up test * feat: select cover image on upload (#3488) * fix: close popover after item selection in settings view (#3362) * fix: close popover after item selection in settings view * fix: add missing await before closing popover * fix: find popover container by context instead of passing controllers around * fix: add requested changes * feat: close text direction settings popups after selection * fix: clean up * fix: restore theme value dropdown as StatefulWidget * feat: openai and stabilityai integration (#3439) * chore: create trait * test: add tests * chore: remove log * chore: disable log * chore: checklist ux flow redesign (#3418) * chore: ux flow redesign * chore: remove unused imports * fix: allow creation of tasks of the same name * chore: apply code suggestions from Mathias * fix: add padding below field title text field (#3440) * Fixed Issue no #3426 * Reversed the pubspec.lock mistaken update * FIXED PADDING * Fixed Padding issue on calender field edit popup * chore: rename package name (#3501) * fix: right icon size sam as left one (#3494) * feat: enable removing user icon (#3487) * feat: enable removing user icon * fix: generate to true * fix: review comments * fix: more review comments * fix: integration test and final changes * fix: made cursor grab and background color when hovering on Appearance Options Buttons (#3498) * chore: calendar UI polish (#3484) * chore: update calendar theming * feat: add event popup editor * chore: new event button redesign and add card shadows * chore: unscheduled events button * chore: event title text field * fix: focus node double dispose * chore: show popover when create new event * test: integrate some tests for integration testing purposes * fix: some fixes and more integration tests * chore: add more space between font item and font menu * feat: add reset font button in toolbar * feat: only show text direction toolbar item when RTL is enabled * fix: unable to change RTL of heading block * test: add integration test for ltr/rtl mode * chore: update inlang project settings (#3441) * feat: using script to update the collab source. (#3508) * chore: add script * chore: update script * chore: update bytes version * chore: submit lock file * chore: update test * chore: update test * chore: bump version * chore: update * ci: fix * ci: fix * chore: update commit id * chore: update commit id * chore: update commit id * fix: is cloud enable --------- Co-authored-by: Fu Zi Xiang <speed2exe@live.com.sg> Co-authored-by: Mathias Mogensen <42929161+Xazin@users.noreply.github.com> Co-authored-by: Vincenzo De Petris <37916223+vincendep@users.noreply.github.com> Co-authored-by: Richard Shiue <71320345+richardshiue@users.noreply.github.com> Co-authored-by: Aryan More <61151896+aryan-more@users.noreply.github.com> Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io> Co-authored-by: Lakhan Baheti <94619783+1akhanBaheti@users.noreply.github.com> Co-authored-by: Nitin-Poojary <70025277+Nitin-Poojary@users.noreply.github.com> Co-authored-by: Jannes Blobel <72493222+jannesblobel@users.noreply.github.com>
150 lines
4.1 KiB
Rust
150 lines
4.1 KiB
Rust
use uuid::Uuid;
|
|
|
|
use flowy_encrypt::{encrypt_text, generate_encryption_secret};
|
|
use flowy_user_deps::entities::*;
|
|
use lib_infra::box_any::BoxAny;
|
|
|
|
use crate::supabase_test::util::{
|
|
get_supabase_ci_config, third_party_sign_up_param, user_auth_service,
|
|
};
|
|
|
|
// ‼️‼️‼️ Warning: this test will create a table in the database
|
|
#[tokio::test]
|
|
async fn supabase_user_sign_up_test() {
|
|
if get_supabase_ci_config().is_none() {
|
|
return;
|
|
}
|
|
let user_service = user_auth_service();
|
|
let uuid = Uuid::new_v4().to_string();
|
|
let params = third_party_sign_up_param(uuid);
|
|
let user: AuthResponse = user_service.sign_up(BoxAny::new(params)).await.unwrap();
|
|
assert!(!user.latest_workspace.id.is_empty());
|
|
assert!(!user.user_workspaces.is_empty());
|
|
assert!(!user.latest_workspace.database_views_aggregate_id.is_empty());
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn supabase_user_sign_up_with_existing_uuid_test() {
|
|
if get_supabase_ci_config().is_none() {
|
|
return;
|
|
}
|
|
let user_service = user_auth_service();
|
|
let uuid = Uuid::new_v4().to_string();
|
|
let params = third_party_sign_up_param(uuid);
|
|
let _user: AuthResponse = user_service
|
|
.sign_up(BoxAny::new(params.clone()))
|
|
.await
|
|
.unwrap();
|
|
let user: AuthResponse = user_service.sign_up(BoxAny::new(params)).await.unwrap();
|
|
assert!(!user.latest_workspace.id.is_empty());
|
|
assert!(!user.latest_workspace.database_views_aggregate_id.is_empty());
|
|
assert!(!user.user_workspaces.is_empty());
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn supabase_update_user_profile_test() {
|
|
if get_supabase_ci_config().is_none() {
|
|
return;
|
|
}
|
|
let user_service = user_auth_service();
|
|
let uuid = Uuid::new_v4().to_string();
|
|
let params = third_party_sign_up_param(uuid);
|
|
let user: AuthResponse = user_service
|
|
.sign_up(BoxAny::new(params.clone()))
|
|
.await
|
|
.unwrap();
|
|
|
|
user_service
|
|
.update_user(
|
|
UserCredentials::from_uid(user.user_id),
|
|
UpdateUserProfileParams {
|
|
uid: user.user_id,
|
|
name: Some("123".to_string()),
|
|
email: Some(format!("{}@test.com", Uuid::new_v4())),
|
|
password: None,
|
|
icon_url: None,
|
|
openai_key: None,
|
|
encryption_sign: None,
|
|
},
|
|
)
|
|
.await
|
|
.unwrap();
|
|
|
|
let user_profile = user_service
|
|
.get_user_profile(UserCredentials::from_uid(user.user_id))
|
|
.await
|
|
.unwrap()
|
|
.unwrap();
|
|
|
|
assert_eq!(user_profile.name, "123");
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn supabase_get_user_profile_test() {
|
|
if get_supabase_ci_config().is_none() {
|
|
return;
|
|
}
|
|
let user_service = user_auth_service();
|
|
let uuid = Uuid::new_v4().to_string();
|
|
let params = third_party_sign_up_param(uuid);
|
|
let user: AuthResponse = user_service
|
|
.sign_up(BoxAny::new(params.clone()))
|
|
.await
|
|
.unwrap();
|
|
|
|
let credential = UserCredentials::from_uid(user.user_id);
|
|
user_service
|
|
.get_user_profile(credential.clone())
|
|
.await
|
|
.unwrap()
|
|
.unwrap();
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn supabase_get_not_exist_user_profile_test() {
|
|
if get_supabase_ci_config().is_none() {
|
|
return;
|
|
}
|
|
|
|
let user_service = user_auth_service();
|
|
let result = user_service
|
|
.get_user_profile(UserCredentials::from_uid(i64::MAX))
|
|
.await
|
|
.unwrap();
|
|
// user not found
|
|
assert!(result.is_none());
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn user_encryption_sign_test() {
|
|
if get_supabase_ci_config().is_none() {
|
|
return;
|
|
}
|
|
let user_service = user_auth_service();
|
|
let uuid = Uuid::new_v4().to_string();
|
|
let params = third_party_sign_up_param(uuid);
|
|
let user: AuthResponse = user_service.sign_up(BoxAny::new(params)).await.unwrap();
|
|
|
|
// generate encryption sign
|
|
let secret = generate_encryption_secret();
|
|
let sign = encrypt_text(user.user_id.to_string(), &secret).unwrap();
|
|
|
|
user_service
|
|
.update_user(
|
|
UserCredentials::from_uid(user.user_id),
|
|
UpdateUserProfileParams::new(user.user_id)
|
|
.with_encryption_type(EncryptionType::SelfEncryption(sign.clone())),
|
|
)
|
|
.await
|
|
.unwrap();
|
|
|
|
let user_profile: UserProfile = user_service
|
|
.get_user_profile(UserCredentials::from_uid(user.user_id))
|
|
.await
|
|
.unwrap()
|
|
.unwrap();
|
|
assert_eq!(
|
|
user_profile.encryption_type,
|
|
EncryptionType::SelfEncryption(sign)
|
|
);
|
|
}
|