From c0a01d7303469df0e16ebc074745dece4ce64077 Mon Sep 17 00:00:00 2001 From: Mike Presman Date: Fri, 8 Dec 2023 16:50:14 -0500 Subject: [PATCH] init --- test/client_new_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/client_new_test.go b/test/client_new_test.go index 0b8b17b..9263174 100644 --- a/test/client_new_test.go +++ b/test/client_new_test.go @@ -40,3 +40,33 @@ func TestClientNewProjectEmptyPackPattern(t *testing.T) { "c": {content: "c v1"}, }) } + +func TestClientNewProjectDuplicateReportsError(t *testing.T) { + tc := util.NewTestCtx(t, auth.Admin, 1) + defer tc.Close() + + c, _, close := createTestClient(tc) + defer close() + + err := c.NewProject(tc.Context(), 1, nil, nil) + require.NoError(t, err, "NewProject") + + /** Create Project Again**/ + + tcSecond := util.NewTestCtx(t, auth.Admin, 1) + defer tc.Close() + + cSecond, _, closeSecond := createTestClient(tc) + defer closeSecond() + + errSecond := cSecond.NewProject(tcSecond.Context(), 1, nil, nil) + + want := "Project with this id already exists" + + if errSecond.Error() != want { + t.Errorf("got %s want %s", errSecond, want) + } + + require.NoError(t, err, "NewProject") + +}