-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub_test.go
More file actions
65 lines (59 loc) · 1.42 KB
/
github_test.go
File metadata and controls
65 lines (59 loc) · 1.42 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package githubwrapper
import (
"context"
"fmt"
"testing"
)
var PersonalToken = "personal"
var Reponame = "namerepo"
var OwnerName = "nameowner"
func TestGetCommitAll(t *testing.T) {
url, err := ListCommitALL(context.Background(),
PersonalToken,
Reponame,
OwnerName)
comms, _ := GetCommit(context.Background(),
PersonalToken,
Reponame,
OwnerName,
url[0].GetSHA())
//fmt.Printf("%+v\n", url)
fmt.Printf("%+v\n", err)
fmt.Printf("%+v\n", comms)
}
func TestGetBranch2(t *testing.T) {
branches, err := GetBranch(context.Background(),
PersonalToken,
OwnerName,
Reponame)
fmt.Printf("%+v\n", branches)
fmt.Printf("%+v\n", err)
}
func TestGetListRepositories(t *testing.T) {
//list, err := ListRepositoriesOrg(context.Background(),
// PersonalToken,
// OwnerName,
//)
Det, err := ListRepositoriesOnlydDetail(context.Background(),
PersonalToken,
OwnerName,
)
fmt.Printf("%+v\n", *Det[0].Name)
fmt.Printf("%+v\n", err)
}
func TestUploadFileToRepository(t *testing.T) {
value := PushRepositories{
Context: context.Background(),
PersonalToken: PersonalToken,
Reponame: Reponame,
OwnerName: OwnerName,
Path: "crot.txt",
Username: "username",
Email: "email@gmail.com",
Message: "Percobaan test push dari golang",
Branch: "master",
}
push, err := UploadFileToRepository(value)
fmt.Printf("err %+v\n", err)
fmt.Printf("err %+v\n", push.Message)
}