func TestCreateUIAlreadyExists(t *testing.T) { var response = httptest.NewRecorder() var request = getRequest(t, "/someFile?create") var store = mockstore.New() var sut = createSut(store) store.GivenWriteAccess() store.GivenMimeType("text/plain") sut.ServeHTTP(response, request) assertResponseBodyNotEmpty(t, response) assertResponseCode(t, response, http.StatusConflict) }
func TestEditUIMissingWritePermission(t *testing.T) { var response = httptest.NewRecorder() var request = getRequest(t, "/someFile?edit") var store = mockstore.New() var sut = createSut(store) store.GivenReadAccess() store.GivenMimeType("text/plain") sut.ServeHTTP(response, request) assertResponseBodyNotEmpty(t, response) assertResponseCode(t, response, http.StatusUnauthorized) }