()
| 3072 | |
| 3073 | #[tokio::test] |
| 3074 | async fn validate_tenant() { |
| 3075 | let _guard = test::prepare().await; |
| 3076 | let user = user::User { |
| 3077 | email: "user@user".into(), |
| 3078 | is_active: true, |
| 3079 | ..Default::default() |
| 3080 | }; |
| 3081 | let tenant_user = user::User { |
| 3082 | email: "tenant@user".into(), |
| 3083 | is_active: true, |
| 3084 | ..Default::default() |
| 3085 | }; |
| 3086 | let tenant_admin = user::User { |
| 3087 | email: "tenant-admin@user".into(), |
| 3088 | is_active: true, |
| 3089 | ..Default::default() |
| 3090 | }; |
| 3091 | let user_inactive = user::User { |
| 3092 | email: "inactive@user".into(), |
| 3093 | ..Default::default() |
| 3094 | }; |
| 3095 | let user_admin = user::User { |
| 3096 | email: "admin@user".into(), |
| 3097 | is_active: true, |
| 3098 | is_admin: true, |
| 3099 | ..Default::default() |
| 3100 | }; |
| 3101 | |
| 3102 | for u in [ |
| 3103 | &user, |
| 3104 | &tenant_user, |
| 3105 | &tenant_admin, |
| 3106 | &user_inactive, |
| 3107 | &user_admin, |
| 3108 | ] { |
| 3109 | user::create(u.clone()).await.unwrap(); |
| 3110 | } |
| 3111 | |
| 3112 | let tenant_a = tenant::test::create_tenant().await; |
| 3113 | |
| 3114 | let api_key_admin = api_key::test::create_api_key(true, false).await; |
| 3115 | let api_key_admin_ro = api_key::create(api_key::ApiKey { |
| 3116 | name: api_key_admin.name.clone(), |
| 3117 | is_admin: api_key_admin.is_admin, |
| 3118 | tenant_id: api_key_admin.tenant_id, |
| 3119 | is_read_only: true, |
| 3120 | ..Default::default() |
| 3121 | }) |
| 3122 | .await |
| 3123 | .unwrap(); |
| 3124 | let api_key_tenant = api_key::test::create_api_key(false, true).await; |
| 3125 | let api_key_tenant_ro = api_key::create(api_key::ApiKey { |
| 3126 | name: api_key_tenant.name.clone(), |
| 3127 | is_admin: api_key_tenant.is_admin, |
| 3128 | tenant_id: api_key_tenant.tenant_id, |
| 3129 | is_read_only: true, |
| 3130 | ..Default::default() |
| 3131 | }) |
nothing calls this directly
no test coverage detected