From cbd5611c2a472790260f5d480f150b1489441a1a Mon Sep 17 00:00:00 2001 From: denispopesku Date: Thu, 11 Jan 2024 14:06:43 +0200 Subject: [PATCH] :test_tube: Added test for staging cloud (QD-7958) --- cloud/cloud_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/cloud/cloud_test.go b/cloud/cloud_test.go index 8e2747c4..c2a91d6e 100644 --- a/cloud/cloud_test.go +++ b/cloud/cloud_test.go @@ -42,6 +42,27 @@ func TestGetProjectByBadToken(t *testing.T) { } } +func TestGetProjectByStaging(t *testing.T) { + err := os.Setenv(QodanaEndpoint, "https://cloud.sssa-stgn.aws.intellij.net") + if err != nil { + t.Fatal(err) + } + token := os.Getenv("QODANA_TOKEN") + if token == "" { + t.Skip() + } + client := NewQdClient(token) + result := client.getProject() + switch v := result.(type) { + case APIError: + if v.StatusCode > http.StatusBadRequest { + t.Errorf("Expected status code %d, got %d", http.StatusBadRequest, v.StatusCode) + } + case RequestError: + t.Errorf("Did not expect request error: %v", v) + } +} + func TestValidateToken(t *testing.T) { client := NewQdClient("kek") if projectName := client.ValidateToken(); projectName != "" {