示例#1
0
文件: editor_test.go 项目: fxnn/gone
func TestCreateUIMissingWritePermission(t *testing.T) {

	var response = httptest.NewRecorder()
	var request = getRequest(t, "/someFile?create")
	var store = mockstore.New()
	var sut = createSut(store)

	store.GivenNotExists()
	sut.ServeHTTP(response, request)

	assertResponseBodyNotEmpty(t, response)
	assertResponseCode(t, response, http.StatusUnauthorized)

}
示例#2
0
文件: editor_test.go 项目: fxnn/gone
func TestCreateUISuccess(t *testing.T) {

	var response = httptest.NewRecorder()
	var request = getRequest(t, "/someFile?create")
	var store = mockstore.New()
	var sut = createSut(store)

	store.GivenWriteAccess()
	store.GivenNotExists()
	sut.ServeHTTP(response, request)

	assertResponseBodyNotEmpty(t, response)
	assertResponseCode(t, response, http.StatusOK)

}