From 84812ac14c428b7af6d6a185bc1894b7ea47dc45 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Wed, 27 Nov 2019 14:02:21 +0100 Subject: Add acceptance tests for new domains source --- acceptance_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'acceptance_test.go') diff --git a/acceptance_test.go b/acceptance_test.go index fe598b0c..3ed69254 100644 --- a/acceptance_test.go +++ b/acceptance_test.go @@ -16,6 +16,7 @@ import ( "time" "github.com/namsral/flag" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -1531,3 +1532,26 @@ func TestApiSecretKeyFlagIsSupported(t *testing.T) { teardown := RunPagesProcess(t, *pagesBinary, listeners, "", "-api-secret-key", "/path/to/secret.key") defer teardown() } + +func TestGitlabDomainsSource(t *testing.T) { + skipUnlessEnabled(t) + + source := NewGitlabDomainsSourceStub(t) + defer source.Close() + + sourceArgs := []string{ + "-gitlab-server", source.URL, + // "-api-secret-key", "/path/to/secret.key", + } + teardown := RunPagesProcess(t, *pagesBinary, listeners, "", sourceArgs...) + defer teardown() + + response, err := GetPageFromListener(t, httpListener, "new-source.test.io", "/my/pages/project/") + require.NoError(t, err) + + defer response.Body.Close() + body, _ := ioutil.ReadAll(response.Body) + + assert.Equal(t, http.StatusOK, response.StatusCode) + assert.Equal(t, "New Pages GitLab Source PoC OK\n", string(body)) +} -- cgit v1.2.3