forked from baron/baron-sso
Biome 및 Go 포맷 적용
This commit is contained in:
@@ -171,6 +171,7 @@ func (m *AsyncMockTenantService) ListTenants(ctx context.Context, limit, offset
|
||||
func (m *AsyncMockTenantService) ListManageableTenants(ctx context.Context, userID string) ([]domain.Tenant, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (m *AsyncMockTenantService) IsDomainAllowed(ctx context.Context, domainName string) (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
@@ -27,16 +27,20 @@ func (m *devMockKetoService) CheckPermission(ctx context.Context, subject, names
|
||||
args := m.Called(ctx, subject, namespace, object, relation)
|
||||
return args.Bool(0), args.Error(1)
|
||||
}
|
||||
|
||||
func (m *devMockKetoService) CreateRelation(ctx context.Context, ns, obj, rel, sub string) error {
|
||||
return m.Called(ctx, ns, obj, rel, sub).Error(0)
|
||||
}
|
||||
|
||||
func (m *devMockKetoService) DeleteRelation(ctx context.Context, ns, obj, rel, sub string) error {
|
||||
return m.Called(ctx, ns, obj, rel, sub).Error(0)
|
||||
}
|
||||
|
||||
func (m *devMockKetoService) ListRelations(ctx context.Context, ns, obj, rel, sub string) ([]service.RelationTuple, error) {
|
||||
args := m.Called(ctx, ns, obj, rel, sub)
|
||||
return args.Get(0).([]service.RelationTuple), args.Error(1)
|
||||
}
|
||||
|
||||
func (m *devMockKetoService) ListObjects(ctx context.Context, ns, rel, sub string) ([]string, error) {
|
||||
args := m.Called(ctx, ns, rel, sub)
|
||||
return args.Get(0).([]string), args.Error(1)
|
||||
@@ -53,6 +57,7 @@ func (m *devMockRedisRepo) Set(key, value string, exp time.Duration) error {
|
||||
m.data[key] = value
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *devMockRedisRepo) Get(key string) (string, error) {
|
||||
v, ok := m.data[key]
|
||||
if !ok {
|
||||
@@ -60,13 +65,14 @@ func (m *devMockRedisRepo) Get(key string) (string, error) {
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
func (m *devMockRedisRepo) Delete(key string) error {
|
||||
delete(m.data, key)
|
||||
return nil
|
||||
}
|
||||
func (m *devMockRedisRepo) StoreVerificationCode(p, c string) error { return nil }
|
||||
func (m *devMockRedisRepo) StoreVerificationCode(p, c string) error { return nil }
|
||||
func (m *devMockRedisRepo) GetVerificationCode(p string) (string, error) { return "", nil }
|
||||
func (m *devMockRedisRepo) DeleteVerificationCode(p string) error { return nil }
|
||||
func (m *devMockRedisRepo) DeleteVerificationCode(p string) error { return nil }
|
||||
|
||||
type devEnhancedMockAuditRepo struct {
|
||||
mockAuditRepo
|
||||
@@ -77,6 +83,7 @@ type devEnhancedMockAuditRepo struct {
|
||||
func (m *devEnhancedMockAuditRepo) CountFailuresSince(ctx context.Context, s time.Time, t string) (int64, error) {
|
||||
return m.countFailures, nil
|
||||
}
|
||||
|
||||
func (m *devEnhancedMockAuditRepo) CountActiveSessionsSince(ctx context.Context, s time.Time, t string) (int64, error) {
|
||||
return m.countSessions, nil
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
import {
|
||||
type AuditLog,
|
||||
type Consent,
|
||||
installDevApiMock,
|
||||
makeClient,
|
||||
seedAuth,
|
||||
type AuditLog,
|
||||
type Consent,
|
||||
} from "./helpers/devfront-fixtures";
|
||||
|
||||
test.describe("DevFront audit logs", () => {
|
||||
@@ -85,7 +85,9 @@ test.describe("DevFront audit logs", () => {
|
||||
await installDevApiMock(page, state);
|
||||
|
||||
await page.goto("/clients/new");
|
||||
await page.getByPlaceholder("My Awesome Application").fill("Realtime New App");
|
||||
await page
|
||||
.getByPlaceholder("My Awesome Application")
|
||||
.fill("Realtime New App");
|
||||
await page
|
||||
.getByPlaceholder(/https:\/\/app\.example\.com\/callback/i)
|
||||
.fill("https://realtime.example.com/callback");
|
||||
@@ -93,7 +95,9 @@ test.describe("DevFront audit logs", () => {
|
||||
await expect.poll(() => state.auditLogs.length).toBeGreaterThanOrEqual(1);
|
||||
|
||||
await page.goto("/clients/client-realtime/settings");
|
||||
await page.getByPlaceholder("My Awesome Application").fill("Realtime Updated");
|
||||
await page
|
||||
.getByPlaceholder("My Awesome Application")
|
||||
.fill("Realtime Updated");
|
||||
await page.getByRole("button", { name: /^저장$|^Save$/i }).click();
|
||||
await expect.poll(() => state.auditLogs.length).toBeGreaterThanOrEqual(2);
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
import {
|
||||
type ClientStatus,
|
||||
type Consent,
|
||||
installDevApiMock,
|
||||
makeClient,
|
||||
seedAuth,
|
||||
type ClientStatus,
|
||||
type Consent,
|
||||
} from "./helpers/devfront-fixtures";
|
||||
|
||||
test.describe("DevFront clients lifecycle", () => {
|
||||
@@ -109,9 +109,9 @@ test.describe("DevFront clients lifecycle", () => {
|
||||
.getByRole("button", { name: /Redirect URIs 저장|Save/i })
|
||||
.click();
|
||||
|
||||
await expect.poll(() => state.clients[0]?.redirectUris[0]).toBe(
|
||||
"https://after.example.com/callback",
|
||||
);
|
||||
await expect
|
||||
.poll(() => state.clients[0]?.redirectUris[0])
|
||||
.toBe("https://after.example.com/callback");
|
||||
|
||||
await page.reload();
|
||||
await expect(
|
||||
|
||||
@@ -43,13 +43,19 @@ export type AuditLog = {
|
||||
export type DevApiMockState = {
|
||||
clients: Client[];
|
||||
consents: Consent[];
|
||||
auditLogsByCursor?: Record<string, { items: AuditLog[]; next_cursor?: string }>;
|
||||
auditLogsByCursor?: Record<
|
||||
string,
|
||||
{ items: AuditLog[]; next_cursor?: string }
|
||||
>;
|
||||
auditLogs?: AuditLog[];
|
||||
onUpdateStatus?: (status: ClientStatus) => void;
|
||||
onRotateSecret?: (newSecret: string) => void;
|
||||
};
|
||||
|
||||
export function makeClient(id: string, overrides: Partial<Client> = {}): Client {
|
||||
export function makeClient(
|
||||
id: string,
|
||||
overrides: Partial<Client> = {},
|
||||
): Client {
|
||||
return {
|
||||
id,
|
||||
name: `${id} app`,
|
||||
@@ -301,7 +307,9 @@ export async function installDevApiMock(page: Page, state: DevApiMockState) {
|
||||
const status = searchParams.get("status") || "";
|
||||
const items = state.consents.filter((row) => {
|
||||
const matchesSubject =
|
||||
!subject || row.subject.includes(subject) || row.userName.includes(subject);
|
||||
!subject ||
|
||||
row.subject.includes(subject) ||
|
||||
row.userName.includes(subject);
|
||||
const matchesClientId = !clientId || row.clientId === clientId;
|
||||
const matchesStatus = !status || row.status === status;
|
||||
return matchesSubject && matchesClientId && matchesStatus;
|
||||
@@ -347,7 +355,8 @@ export async function installDevApiMock(page: Page, state: DevApiMockState) {
|
||||
};
|
||||
} catch {}
|
||||
const matchesAction = !action || parsedDetails.action === action;
|
||||
const matchesClient = !clientId || parsedDetails.target_id === clientId;
|
||||
const matchesClient =
|
||||
!clientId || parsedDetails.target_id === clientId;
|
||||
const matchesStatus = !status || item.status === status;
|
||||
return matchesAction && matchesClient && matchesStatus;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user