diff --git a/.gitignore b/.gitignore index 4ccbb02b..749f8cb5 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ contrib/kubernetes/helm/alerta/charts .idea/* /.bundle/ + +/venv/ diff --git a/tests/spec/api_spec.rb b/tests/spec/api_spec.rb index 53388b5f..bcdbe2ef 100644 --- a/tests/spec/api_spec.rb +++ b/tests/spec/api_spec.rb @@ -26,44 +26,50 @@ expect(JSON.parse(result.body)['provider']).to eq("basic") end end - context "/management" do - context "get properties" do - result = Client.get "#{GATEWAY_BASE_URL}/management/properties", {'x-api-key' => 'demo-key'} - it "return 200" do - expect(result.code).to eq(200) - end - it "X-Forwarded-For header is set" do - expect(result.body).to include("X-Forwarded-For") - end + end + context "/management" do + context "get manifest" do + result = Client.get "#{GATEWAY_BASE_URL}/management/manifest", {'x-api-key' => 'demo-key'} + it "return 200" do + expect(result.code).to eq(200) + end + end + context "get properties" do + result = Client.get "#{GATEWAY_BASE_URL}/management/properties", {'x-api-key' => 'demo-key'} + it "return 200" do + expect(result.code).to eq(200) + end + it "X-Forwarded-For header is set" do + expect(result.body).to include("X-Forwarded-For") + end + end + context "get healthcheck" do + result = Client.get "#{GATEWAY_BASE_URL}/management/gtg" + it "return 200" do + expect(result.code).to eq(200) + end + it "good-to-go is OK" do + expect(result.body).to eq("OK") + end + it "response header does not contain nginx version" do + expect(result.headers[:server]).to eq("nginx") end - context "get healthcheck" do - result = Client.get "#{GATEWAY_BASE_URL}/management/gtg" - it "return 200" do - expect(result.code).to eq(200) - end - it "good-to-go is OK" do - expect(result.body).to eq("OK") - end - it "response header does not contain nginx version" do - expect(result.headers[:server]).to eq("nginx") - end + end + end + context "/alerts" do + context "get without auth" do + result = Client.get "#{GATEWAY_BASE_URL}/alerts" + it "return 401" do + expect(result.code).to eq(401) end end - context "/alerts" do - context "get without auth" do - result = Client.get "#{GATEWAY_BASE_URL}/alerts" - it "return 401" do - expect(result.code).to eq(401) - end + context "get" do + result = Client.get "#{GATEWAY_BASE_URL}/alerts?api-key=demo-key" + it "return 200" do + expect(result.code).to eq(200) end - context "get" do - result = Client.get "#{GATEWAY_BASE_URL}/alerts?api-key=demo-key" - it "return 200" do - expect(result.code).to eq(200) - end - it "total is 0" do - expect(JSON.parse(result.body)['total']).to eq(0) - end + it "total is 0" do + expect(JSON.parse(result.body)['total']).to eq(0) end end end