forked from camunda/github-backup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_test.go
47 lines (36 loc) · 900 Bytes
/
main_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
package main
import (
"testing"
"fmt"
"os"
)
func TestGithubBackupConstructor(t *testing.T) {
backup := NewGithubBackup()
if backup == nil {
t.Fatal("Allocation failed.")
}
backup.login()
repos, err := backup.getRepositories("camunda-ci")
checkErr(err)
if len(repos) < 50 {
t.Fatal("Number of repositories is wrongs")
}
}
func TestConfig(t *testing.T) {
config := readConfig()
if config == nil {
t.Fatal("Reading configuration failed.")
}
}
func TestCloneRepository(t *testing.T) {
backup := NewGithubBackup()
backup.login()
repos, err := backup.getRepositories("camunda-ci")
checkErr(err)
backup.wg.Add(2)
path := fmt.Sprintf(TMP_REPO_PATH, "test", "camunda-ci", *(repos[0].Name))
backup.cloneRepository(repos[0], path)
path2 := fmt.Sprintf(TMP_REPO_PATH, "test", "camunda-ci", *(repos[1].Name))
backup.cloneRepository(repos[1], path2)
os.RemoveAll("test")
}