linting, tenant slug -> name
This commit is contained in:
@@ -33,7 +33,8 @@ struct ErrorResponse {
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct LoginTenant {
|
||||
slug: String,
|
||||
id: Uuid,
|
||||
name: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@@ -51,7 +52,7 @@ struct TenantSelectionResponse {
|
||||
#[derive(Deserialize)]
|
||||
struct TenantSummary {
|
||||
id: Uuid,
|
||||
slug: String,
|
||||
name: String,
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -116,7 +117,7 @@ async fn signup_creates_user_tenant_and_membership() -> Result<()> {
|
||||
.first(conn)?;
|
||||
|
||||
let tenant: backend::models::Tenant = tenants::table
|
||||
.filter(tenants::slug.eq("signup-user"))
|
||||
.filter(tenants::name.eq("signup-user"))
|
||||
.first(conn)?;
|
||||
|
||||
assert_eq!(tenant.status, TenantStatus::Creating);
|
||||
@@ -419,7 +420,7 @@ async fn refresh_rotates_refresh_token() -> Result<()> {
|
||||
let new_cookie = extract_refresh_cookie(response.headers())?;
|
||||
let body = body_to_vec(response.into_body()).await?;
|
||||
let refreshed: LoginResponse = serde_json::from_slice(&body)?;
|
||||
assert_eq!(refreshed.tenant.slug, login.tenant.slug);
|
||||
assert_eq!(refreshed.tenant.name, login.tenant.name);
|
||||
|
||||
let me_response = app
|
||||
.get("/api/auth/me", Some(&refreshed.access_token))
|
||||
@@ -492,14 +493,14 @@ async fn login_returns_tenant_selection_when_multiple_memberships() -> Result<()
|
||||
let password = "multipass";
|
||||
let user_id = app.insert_user("multipass", password, "admin").await?;
|
||||
|
||||
let secondary_slug = "secondary".to_string();
|
||||
let slug_for_insert = secondary_slug.clone();
|
||||
let secondary_name = "secondary".to_string();
|
||||
let name_for_insert = secondary_name.clone();
|
||||
let secondary_id = Uuid::new_v4();
|
||||
app.with_conn(move |conn| {
|
||||
diesel::insert_into(tenants::table)
|
||||
.values((
|
||||
tenants::id.eq(secondary_id),
|
||||
tenants::slug.eq(&slug_for_insert),
|
||||
tenants::name.eq(&name_for_insert),
|
||||
tenants::status.eq(TenantStatus::Active),
|
||||
))
|
||||
.execute(conn)?;
|
||||
@@ -526,7 +527,7 @@ async fn login_returns_tenant_selection_when_multiple_memberships() -> Result<()
|
||||
let secondary = selection
|
||||
.tenants
|
||||
.iter()
|
||||
.find(|tenant| tenant.slug == secondary_slug)
|
||||
.find(|tenant| tenant.name == secondary_name)
|
||||
.map(|t| t.id)
|
||||
.context("secondary tenant missing from selection")?;
|
||||
|
||||
@@ -541,7 +542,7 @@ async fn login_returns_tenant_selection_when_multiple_memberships() -> Result<()
|
||||
let session_cookie = extract_refresh_cookie(select_response.headers())?;
|
||||
let select_body = body_to_vec(select_response.into_body()).await?;
|
||||
let login: LoginResponse = serde_json::from_slice(&select_body)?;
|
||||
assert_eq!(login.tenant.slug, secondary_slug);
|
||||
assert_eq!(login.tenant.name, secondary_name);
|
||||
|
||||
let me_response = app.get("/api/auth/me", Some(&login.access_token)).await?;
|
||||
assert_eq!(me_response.status(), StatusCode::OK);
|
||||
|
||||
Reference in New Issue
Block a user