tested real proxmox connection
--> passed
This commit is contained in:
@@ -57,6 +57,22 @@ func TestListProjectVMsReturnsVisibleVMs(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestListProjectVMsReturnsEmptyArray(t *testing.T) {
|
||||
handler := NewHandler(&stubRepository{listFound: true})
|
||||
req := requestWithPrincipal(http.MethodGet, "/projects/project-1/vms")
|
||||
req.SetPathValue("projectID", "project-1")
|
||||
rec := httptest.NewRecorder()
|
||||
|
||||
handler.ListProjectVMs(rec, req)
|
||||
|
||||
if rec.Code != http.StatusOK {
|
||||
t.Fatalf("status = %d, want %d", rec.Code, http.StatusOK)
|
||||
}
|
||||
if got := rec.Body.String(); got != "{\"data\":[]}\n" {
|
||||
t.Fatalf("body = %q, want empty data array", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestListProjectVMsReturnsNotFoundForInaccessibleProject(t *testing.T) {
|
||||
handler := NewHandler(&stubRepository{listFound: false})
|
||||
req := requestWithPrincipal(http.MethodGet, "/projects/project-1/vms")
|
||||
|
||||
Reference in New Issue
Block a user