-
Notifications
You must be signed in to change notification settings - Fork 0
/
GrootTest.groovy
64 lines (49 loc) · 1.88 KB
/
GrootTest.groovy
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
class GrootTest extends GroovyTestCase {
void testDotnet() {
Groot groot = new Groot()
auth(groot)
groot.githubRepos("dotnet")
assert groot.repos.size() == 12
def topstars = groot.githubTopRepos(5, "stargazers_count")
assert topstars[0].name == "corefx"
def forks = groot.githubTopRepos(5, "forks_count")
assert forks[0].name == "corefx"
def pulls = groot.githubTopRepos(5, "ext_pullrequests_count")
assert pulls[0].name == "roslyn"
def contribs = groot.githubTopRepos(5, "ext_contrib_pct")
assert contribs[0].name == "codeformatter"
}
void testNasa() {
Groot groot = new Groot()
auth(groot)
groot.githubRepos("nasa")
assert groot.repos.size() == 53
def topstars = groot.githubTopRepos(5, "stargazers_count")
assert topstars[0].name == "mct"
def forks = groot.githubTopRepos(5, "forks_count")
assert forks[0].name == "mct"
def pulls = groot.githubTopRepos(5, "ext_pullrequests_count")
assert pulls[0].name == "osal"
def contribs = groot.githubTopRepos(5, "ext_contrib_pct")
assert contribs[0].name == "Open-Source-Catalog"
}
void testNetflix() {
Groot groot = new Groot()
auth(groot)
groot.githubRepos("netflix")
assert groot.repos.size() == 64
def topstars = groot.githubTopRepos(5, "stargazers_count")
assert topstars[0].name == "Hystrix"
def forks = groot.githubTopRepos(5, "forks_count")
assert forks[0].name == "Cloud-Prize"
def pulls = groot.githubTopRepos(5, "ext_pullrequests_count")
assert pulls[0].name == "astyanax"
def contribs = groot.githubTopRepos(5, "ext_contrib_pct")
assert contribs[0].name == "Surus"
}
private static void auth(groot) {
def user = System.getProperty("user")
def pass = System.getProperty("pass")
Groot.headers += ["Authorization" : 'Basic ' + "${user}:${pass}".bytes.encodeBase64().toString()]
}
}