2022-05-12 15:01:28 +00:00
|
|
|
import * as Types from "../api/types"
|
|
|
|
import * as TypesGen from "../api/typesGenerated"
|
|
|
|
|
|
|
|
export const MockSessionToken: TypesGen.LoginWithPasswordResponse = {
|
|
|
|
session_token: "my-session-token",
|
|
|
|
}
|
|
|
|
|
|
|
|
export const MockAPIKey: TypesGen.GenerateAPIKeyResponse = {
|
|
|
|
key: "my-api-key",
|
|
|
|
}
|
|
|
|
|
|
|
|
export const MockBuildInfo: TypesGen.BuildInfoResponse = {
|
2022-04-07 17:18:58 +00:00
|
|
|
external_url: "file:///mock-url",
|
|
|
|
version: "v99.999.9999+c9cdf14",
|
|
|
|
}
|
|
|
|
|
2022-05-12 15:01:28 +00:00
|
|
|
export const MockAdminRole: TypesGen.Role = {
|
2022-05-10 19:13:07 +00:00
|
|
|
name: "admin",
|
|
|
|
display_name: "Admin",
|
|
|
|
}
|
|
|
|
|
2022-05-12 15:01:28 +00:00
|
|
|
export const MockMemberRole: TypesGen.Role = {
|
2022-05-10 19:13:07 +00:00
|
|
|
name: "member",
|
|
|
|
display_name: "Member",
|
|
|
|
}
|
|
|
|
|
2022-05-12 15:01:28 +00:00
|
|
|
export const MockAuditorRole: TypesGen.Role = {
|
2022-05-10 19:13:07 +00:00
|
|
|
name: "auditor",
|
|
|
|
display_name: "Auditor",
|
|
|
|
}
|
|
|
|
|
|
|
|
export const MockSiteRoles = [MockAdminRole, MockAuditorRole, MockMemberRole]
|
|
|
|
|
2022-05-12 15:01:28 +00:00
|
|
|
export const MockUser: TypesGen.User = {
|
2022-03-23 14:09:43 +00:00
|
|
|
id: "test-user",
|
2022-01-26 00:36:26 +00:00
|
|
|
username: "TestUser",
|
|
|
|
email: "test@coder.com",
|
|
|
|
created_at: "",
|
2022-04-28 20:32:23 +00:00
|
|
|
status: "active",
|
|
|
|
organization_ids: ["fc0774ce-cc9e-48d4-80ae-88f7a4d4a8b0"],
|
2022-05-10 19:13:07 +00:00
|
|
|
roles: [MockAdminRole, MockMemberRole],
|
2022-01-26 00:36:26 +00:00
|
|
|
}
|
|
|
|
|
2022-05-12 15:01:28 +00:00
|
|
|
export const MockUser2: TypesGen.User = {
|
2022-04-14 17:57:55 +00:00
|
|
|
id: "test-user-2",
|
|
|
|
username: "TestUser2",
|
|
|
|
email: "test2@coder.com",
|
|
|
|
created_at: "",
|
2022-04-28 20:32:23 +00:00
|
|
|
status: "active",
|
|
|
|
organization_ids: ["fc0774ce-cc9e-48d4-80ae-88f7a4d4a8b0"],
|
2022-05-10 19:13:07 +00:00
|
|
|
roles: [MockMemberRole],
|
2022-04-14 17:57:55 +00:00
|
|
|
}
|
|
|
|
|
2022-05-12 15:01:28 +00:00
|
|
|
export const MockOrganization: TypesGen.Organization = {
|
2022-03-23 14:09:43 +00:00
|
|
|
id: "test-org",
|
|
|
|
name: "Test Organization",
|
2022-01-26 00:36:26 +00:00
|
|
|
created_at: "",
|
|
|
|
updated_at: "",
|
|
|
|
}
|
|
|
|
|
2022-05-12 15:01:28 +00:00
|
|
|
export const MockProvisioner: TypesGen.ProvisionerDaemon = {
|
|
|
|
created_at: "",
|
2022-01-26 00:36:26 +00:00
|
|
|
id: "test-provisioner",
|
|
|
|
name: "Test Provisioner",
|
2022-05-12 15:01:28 +00:00
|
|
|
provisioners: [],
|
|
|
|
}
|
|
|
|
|
|
|
|
export const MockProvisionerJob: TypesGen.ProvisionerJob = {
|
|
|
|
created_at: "",
|
|
|
|
id: "test-provisioner-job",
|
|
|
|
status: "succeeded",
|
2022-01-26 00:36:26 +00:00
|
|
|
}
|
|
|
|
|
2022-05-12 15:01:28 +00:00
|
|
|
export const MockTemplate: TypesGen.Template = {
|
2022-04-06 17:42:40 +00:00
|
|
|
id: "test-template",
|
2022-01-26 00:36:26 +00:00
|
|
|
created_at: "",
|
|
|
|
updated_at: "",
|
2022-03-23 14:09:43 +00:00
|
|
|
organization_id: MockOrganization.id,
|
2022-04-06 17:42:40 +00:00
|
|
|
name: "Test Template",
|
2022-03-23 14:09:43 +00:00
|
|
|
provisioner: MockProvisioner.id,
|
|
|
|
active_version_id: "",
|
2022-05-12 15:01:28 +00:00
|
|
|
workspace_owner_count: 1,
|
2022-01-26 00:36:26 +00:00
|
|
|
}
|
2022-01-26 03:50:31 +00:00
|
|
|
|
2022-05-12 15:01:28 +00:00
|
|
|
export const MockWorkspaceAutostartDisabled: TypesGen.UpdateWorkspaceAutostartRequest = {
|
2022-04-14 00:35:47 +00:00
|
|
|
schedule: "",
|
|
|
|
}
|
|
|
|
|
2022-05-12 15:01:28 +00:00
|
|
|
export const MockWorkspaceAutostartEnabled: TypesGen.UpdateWorkspaceAutostartRequest = {
|
2022-04-14 00:35:47 +00:00
|
|
|
// Runs at 9:30am Monday through Friday using Canada/Eastern
|
|
|
|
// (America/Toronto) time
|
2022-04-18 16:04:48 +00:00
|
|
|
schedule: "CRON_TZ=Canada/Eastern 30 9 * * 1-5",
|
2022-04-14 00:35:47 +00:00
|
|
|
}
|
|
|
|
|
2022-05-12 15:01:28 +00:00
|
|
|
export const MockWorkspaceAutostopDisabled: TypesGen.UpdateWorkspaceAutostartRequest = {
|
2022-04-14 00:35:47 +00:00
|
|
|
schedule: "",
|
|
|
|
}
|
|
|
|
|
2022-05-12 15:01:28 +00:00
|
|
|
export const MockWorkspaceAutostopEnabled: TypesGen.UpdateWorkspaceAutostartRequest = {
|
2022-04-14 00:35:47 +00:00
|
|
|
// Runs at 9:30pm Monday through Friday using America/Toronto
|
2022-04-18 16:04:48 +00:00
|
|
|
schedule: "CRON_TZ=America/Toronto 30 21 * * 1-5",
|
2022-04-14 00:35:47 +00:00
|
|
|
}
|
|
|
|
|
2022-05-12 15:01:28 +00:00
|
|
|
export const MockWorkspaceBuild: TypesGen.WorkspaceBuild = {
|
|
|
|
after_id: "",
|
|
|
|
before_id: "",
|
|
|
|
created_at: "",
|
|
|
|
id: "test-workspace-build",
|
|
|
|
initiator_id: "",
|
|
|
|
job: MockProvisionerJob,
|
|
|
|
name: "a-workspace-build",
|
|
|
|
template_version_id: "",
|
|
|
|
transition: "start",
|
|
|
|
updated_at: "",
|
|
|
|
workspace_id: "test-workspace",
|
|
|
|
}
|
|
|
|
|
|
|
|
export const MockWorkspace: TypesGen.Workspace = {
|
2022-01-26 03:50:31 +00:00
|
|
|
id: "test-workspace",
|
|
|
|
name: "Test-Workspace",
|
|
|
|
created_at: "",
|
|
|
|
updated_at: "",
|
2022-04-06 17:42:40 +00:00
|
|
|
template_id: MockTemplate.id,
|
2022-05-12 15:01:28 +00:00
|
|
|
template_name: MockTemplate.name,
|
|
|
|
outdated: false,
|
2022-03-23 14:09:43 +00:00
|
|
|
owner_id: MockUser.id,
|
2022-05-14 01:41:21 +00:00
|
|
|
owner_name: MockUser.username,
|
2022-04-14 00:35:47 +00:00
|
|
|
autostart_schedule: MockWorkspaceAutostartEnabled.schedule,
|
|
|
|
autostop_schedule: MockWorkspaceAutostopEnabled.schedule,
|
2022-05-12 15:01:28 +00:00
|
|
|
latest_build: MockWorkspaceBuild,
|
2022-04-29 22:30:10 +00:00
|
|
|
}
|
|
|
|
|
2022-05-12 15:01:28 +00:00
|
|
|
export const MockWorkspaceAgent: TypesGen.WorkspaceAgent = {
|
|
|
|
architecture: "amd64",
|
|
|
|
created_at: "",
|
|
|
|
environment_variables: {},
|
2022-04-29 22:30:10 +00:00
|
|
|
id: "test-workspace-agent",
|
|
|
|
name: "a-workspace-agent",
|
|
|
|
operating_system: "linux",
|
2022-05-12 15:01:28 +00:00
|
|
|
resource_id: "",
|
|
|
|
status: "connected",
|
|
|
|
updated_at: "",
|
2022-04-29 22:30:10 +00:00
|
|
|
}
|
|
|
|
|
2022-05-12 15:01:28 +00:00
|
|
|
export const MockWorkspaceResource: TypesGen.WorkspaceResource = {
|
2022-04-29 22:30:10 +00:00
|
|
|
agents: [MockWorkspaceAgent],
|
2022-05-12 15:01:28 +00:00
|
|
|
created_at: "",
|
|
|
|
id: "test-workspace-resource",
|
|
|
|
job_id: "",
|
|
|
|
name: "a-workspace-resource",
|
|
|
|
type: "google_compute_disk",
|
|
|
|
workspace_transition: "start",
|
2022-01-26 03:50:31 +00:00
|
|
|
}
|
2022-03-23 14:28:34 +00:00
|
|
|
|
2022-05-12 15:01:28 +00:00
|
|
|
export const MockUserAgent: Types.UserAgent = {
|
2022-03-23 14:28:34 +00:00
|
|
|
browser: "Chrome 99.0.4844",
|
|
|
|
device: "Other",
|
|
|
|
ip_address: "11.22.33.44",
|
|
|
|
os: "Windows 10",
|
|
|
|
}
|
2022-04-23 22:58:57 +00:00
|
|
|
|
2022-05-12 15:01:28 +00:00
|
|
|
export const MockAuthMethods: TypesGen.AuthMethods = {
|
2022-04-23 22:58:57 +00:00
|
|
|
password: true,
|
|
|
|
github: false,
|
|
|
|
}
|