Remove bulk user creation admin API
This commit is contained in:
parent
963ced1dd8
commit
e77263a3c7
3 changed files with 1 additions and 142 deletions
|
@ -55,70 +55,6 @@ async fn test_get_users_by_ids() {
|
|||
}
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn test_create_users() {
|
||||
let db = TestDb::postgres().await;
|
||||
let db = db.db();
|
||||
|
||||
// Create the first batch of users, ensuring invite counts are assigned
|
||||
// correctly and the respective invite codes are unique.
|
||||
let user_ids_batch_1 = db
|
||||
.create_users(vec![
|
||||
("user1".to_string(), "hi@user1.com".to_string(), 5),
|
||||
("user2".to_string(), "hi@user2.com".to_string(), 4),
|
||||
("user3".to_string(), "hi@user3.com".to_string(), 3),
|
||||
])
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(user_ids_batch_1.len(), 3);
|
||||
|
||||
let users = db.get_users_by_ids(user_ids_batch_1.clone()).await.unwrap();
|
||||
assert_eq!(users.len(), 3);
|
||||
assert_eq!(users[0].github_login, "user1");
|
||||
assert_eq!(users[0].email_address.as_deref(), Some("hi@user1.com"));
|
||||
assert_eq!(users[0].invite_count, 5);
|
||||
assert_eq!(users[1].github_login, "user2");
|
||||
assert_eq!(users[1].email_address.as_deref(), Some("hi@user2.com"));
|
||||
assert_eq!(users[1].invite_count, 4);
|
||||
assert_eq!(users[2].github_login, "user3");
|
||||
assert_eq!(users[2].email_address.as_deref(), Some("hi@user3.com"));
|
||||
assert_eq!(users[2].invite_count, 3);
|
||||
|
||||
let invite_code_1 = users[0].invite_code.clone().unwrap();
|
||||
let invite_code_2 = users[1].invite_code.clone().unwrap();
|
||||
let invite_code_3 = users[2].invite_code.clone().unwrap();
|
||||
assert_ne!(invite_code_1, invite_code_2);
|
||||
assert_ne!(invite_code_1, invite_code_3);
|
||||
assert_ne!(invite_code_2, invite_code_3);
|
||||
|
||||
// Create the second batch of users and include a user that is already in the database, ensuring
|
||||
// the invite count for the existing user is updated without changing their invite code.
|
||||
let user_ids_batch_2 = db
|
||||
.create_users(vec![
|
||||
("user2".to_string(), "hi@user2.com".to_string(), 10),
|
||||
("user4".to_string(), "hi@user4.com".to_string(), 2),
|
||||
])
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(user_ids_batch_2.len(), 2);
|
||||
assert_eq!(user_ids_batch_2[0], user_ids_batch_1[1]);
|
||||
|
||||
let users = db.get_users_by_ids(user_ids_batch_2).await.unwrap();
|
||||
assert_eq!(users.len(), 2);
|
||||
assert_eq!(users[0].github_login, "user2");
|
||||
assert_eq!(users[0].email_address.as_deref(), Some("hi@user2.com"));
|
||||
assert_eq!(users[0].invite_count, 10);
|
||||
assert_eq!(users[0].invite_code, Some(invite_code_2.clone()));
|
||||
assert_eq!(users[1].github_login, "user4");
|
||||
assert_eq!(users[1].email_address.as_deref(), Some("hi@user4.com"));
|
||||
assert_eq!(users[1].invite_count, 2);
|
||||
|
||||
let invite_code_4 = users[1].invite_code.clone().unwrap();
|
||||
assert_ne!(invite_code_4, invite_code_1);
|
||||
assert_ne!(invite_code_4, invite_code_2);
|
||||
assert_ne!(invite_code_4, invite_code_3);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn test_worktree_extensions() {
|
||||
let test_db = TestDb::postgres().await;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue