From f47927331fce77086a24d03550fca445c6c5652f Mon Sep 17 00:00:00 2001 From: Andrew Keesler Date: Fri, 24 Jul 2020 11:17:32 -0400 Subject: [PATCH] Condense discovery integration tests I think these tests do roughly the same thing... Signed-off-by: Andrew Keesler --- test/integration/loginrequest_test.go | 44 --------------------------- 1 file changed, 44 deletions(-) diff --git a/test/integration/loginrequest_test.go b/test/integration/loginrequest_test.go index 132da669..3b85361e 100644 --- a/test/integration/loginrequest_test.go +++ b/test/integration/loginrequest_test.go @@ -7,8 +7,6 @@ package integration import ( "context" - "encoding/json" - "net/http" "os" "testing" "time" @@ -114,51 +112,9 @@ func TestLoginRequest_ShouldFailWhenRequestDoesNotIncludeToken(t *testing.T) { require.Nil(t, response.Status.Credential) } -func TestGetDiscovery(t *testing.T) { - client := library.NewPlaceholderNameClientset(t) - - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) - defer cancel() - - result, err := client.Discovery().RESTClient().Get().Do(ctx).Raw() - require.NoError(t, err) - - var parsedResult map[string]interface{} - err = json.Unmarshal(result, &parsedResult) - require.NoError(t, err) - require.Contains(t, parsedResult["paths"], "/apis/placeholder.suzerain-io.github.io") - require.Contains(t, parsedResult["paths"], "/apis/placeholder.suzerain-io.github.io/v1alpha1") -} - func TestGetAPIResourceList(t *testing.T) { - var expectedAPIResourceList = `{ - "kind": "APIResourceList", - "apiVersion": "v1", - "groupVersion": "placeholder.suzerain-io.github.io/v1alpha1", - "resources": [ - { - "name": "loginrequests", - "singularName": "", - "namespaced": false, - "kind": "LoginRequest", - "verbs": [ - "create" - ] - } - ] - }` - client := library.NewPlaceholderNameClientset(t) - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) - defer cancel() - - result, err := client.PlaceholderV1alpha1().RESTClient().Get().Do(ctx).Raw() - require.NoError(t, err) - require.JSONEq(t, expectedAPIResourceList, string(result)) - - // proposed: - groups, resources, err := client.Discovery().ServerGroupsAndResources() require.NoError(t, err)