forked from Silverfish/proton-bridge
Fix empty label name
This commit is contained in:
@ -147,6 +147,16 @@ func TestClient_CreateLabel(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestClient_CreateEmptyLabel(t *testing.T) {
|
||||
s, c := newTestServer(http.HandlerFunc(func(_ http.ResponseWriter, _ *http.Request) {
|
||||
r.Fail(t, "API should not be called")
|
||||
}))
|
||||
defer s.Close()
|
||||
|
||||
_, err := c.CreateLabel(&Label{})
|
||||
r.EqualError(t, err, "name is required")
|
||||
}
|
||||
|
||||
func TestClient_UpdateLabel(t *testing.T) {
|
||||
s, c := newTestServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
Ok(t, checkMethodAndPath(r, "PUT", "/labels/"+testLabelCreated.ID))
|
||||
@ -173,6 +183,16 @@ func TestClient_UpdateLabel(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestClient_UpdateLabelToEmptyName(t *testing.T) {
|
||||
s, c := newTestServer(http.HandlerFunc(func(_ http.ResponseWriter, _ *http.Request) {
|
||||
r.Fail(t, "API should not be called")
|
||||
}))
|
||||
defer s.Close()
|
||||
|
||||
_, err := c.UpdateLabel(&Label{ID: "label"})
|
||||
r.EqualError(t, err, "name is required")
|
||||
}
|
||||
|
||||
func TestClient_DeleteLabel(t *testing.T) {
|
||||
s, c := newTestServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
Ok(t, checkMethodAndPath(r, "DELETE", "/labels/"+testLabelCreated.ID))
|
||||
|
||||
Reference in New Issue
Block a user