forked from xanzy/go-gitlab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepository_submodules_test.go
51 lines (45 loc) · 1.4 KB
/
repository_submodules_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package gitlab
import (
"fmt"
"net/http"
"testing"
"github.com/stretchr/testify/require"
)
func TestRepositorySubmodulesService_UpdateSubmodule(t *testing.T) {
mux, client := setup(t)
mux.HandleFunc("/api/v4/projects/13083/repository/submodules/app%2Fproject", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodPut)
fmt.Fprintf(w, `
{
"id": "6104942438c14ec7bd21c6cd5bd995272b3faff6",
"short_id": "6104942438c",
"title": "Update my submodule",
"author_name": "popdabubbles",
"author_email": "[email protected]",
"committer_name": "Will",
"committer_email": "[email protected]",
"message": "Update my submodule",
"parent_ids": [
"ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"
],
"status": "running"
}
`)
})
want := &SubmoduleCommit{
ID: "6104942438c14ec7bd21c6cd5bd995272b3faff6",
ShortID: "6104942438c",
Title: "Update my submodule",
AuthorName: "popdabubbles",
AuthorEmail: "[email protected]",
CommitterName: "Will",
CommitterEmail: "[email protected]",
Message: "Update my submodule",
ParentIDs: []string{"ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"},
Status: BuildState(Running),
}
sc, resp, err := client.RepositorySubmodules.UpdateSubmodule(13083, "app%2Fproject", nil)
require.NoError(t, err)
require.NotNil(t, resp)
require.Equal(t, want, sc)
}