()
| 3364 | |
| 3365 | #[tokio::test] |
| 3366 | async fn tenant_user() { |
| 3367 | let _guard = test::prepare().await; |
| 3368 | |
| 3369 | let user = user::User { |
| 3370 | email: "user@user".into(), |
| 3371 | is_active: true, |
| 3372 | ..Default::default() |
| 3373 | }; |
| 3374 | let user_admin = user::User { |
| 3375 | email: "admin@user".into(), |
| 3376 | is_active: true, |
| 3377 | is_admin: true, |
| 3378 | ..Default::default() |
| 3379 | }; |
| 3380 | let tenant_admin = user::User { |
| 3381 | email: "tenant-admin@user".into(), |
| 3382 | is_active: true, |
| 3383 | ..Default::default() |
| 3384 | }; |
| 3385 | let tenant_user = user::User { |
| 3386 | email: "tenant-user@user".into(), |
| 3387 | is_active: true, |
| 3388 | ..Default::default() |
| 3389 | }; |
| 3390 | let tenant_user_other = user::User { |
| 3391 | email: "tenant-user-other@user".into(), |
| 3392 | is_active: true, |
| 3393 | ..Default::default() |
| 3394 | }; |
| 3395 | |
| 3396 | for u in [ |
| 3397 | &user, |
| 3398 | &user_admin, |
| 3399 | &tenant_admin, |
| 3400 | &tenant_user, |
| 3401 | &tenant_user_other, |
| 3402 | ] { |
| 3403 | user::create(u.clone()).await.unwrap(); |
| 3404 | } |
| 3405 | |
| 3406 | let tenant_a = tenant::test::create_tenant().await; |
| 3407 | |
| 3408 | let api_key_admin = api_key::test::create_api_key(true, false).await; |
| 3409 | let api_key_admin_ro = api_key::create(api_key::ApiKey { |
| 3410 | name: api_key_admin.name.clone(), |
| 3411 | is_admin: api_key_admin.is_admin, |
| 3412 | tenant_id: api_key_admin.tenant_id, |
| 3413 | is_read_only: true, |
| 3414 | ..Default::default() |
| 3415 | }) |
| 3416 | .await |
| 3417 | .unwrap(); |
| 3418 | let api_key_tenant = api_key::test::create_api_key(false, true).await; |
| 3419 | let api_key_tenant_ro = api_key::create(api_key::ApiKey { |
| 3420 | name: api_key_tenant.name.clone(), |
| 3421 | is_admin: api_key_tenant.is_admin, |
| 3422 | tenant_id: api_key_tenant.tenant_id, |
| 3423 | is_read_only: true, |
nothing calls this directly
no test coverage detected