OLD | NEW |
| (Empty) |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE.md file. | |
4 | |
5 import 'package:expect/expect.dart'; | |
6 | |
7 import '../github_services.dart'; | |
8 import '../github_mock.dart'; | |
9 | |
10 void main() { | |
11 var mock = new GithubMock()..verbose = true..spawn(); | |
12 var server = new Server(mock.host, mock.port); | |
13 testError(server); | |
14 testUser(server); | |
15 testRepository(server); | |
16 testCommits(server); | |
17 server.close(); | |
18 mock.close(); | |
19 } | |
20 | |
21 void testUser(Server server) { | |
22 var user = server.getUser('dartino'); | |
23 Expect.stringEquals('dartino', user['login']); | |
24 } | |
25 | |
26 void testRepository(Server server) { | |
27 var user = server.getUser('dartino'); | |
28 var repo = user.getRepository('sdk'); | |
29 Expect.stringEquals('dartino/sdk', repo['full_name']); | |
30 } | |
31 | |
32 void testError(Server server) { | |
33 var user = server.getUser('dartino-no-such-user'); | |
34 Expect.throws(() { user['login']; }); | |
35 } | |
36 | |
37 void testCommits(Server server) { | |
38 var user = server.getUser('dartino'); | |
39 var repo = user.getRepository('sdk'); | |
40 var commit = repo.getCommitAt(0); | |
41 Expect.stringEquals('Martin Kustermann', commit['commit']['author']['name']); | |
42 commit = repo.getCommitAt(60); | |
43 Expect.stringEquals('Søren Gjesse', commit['commit']['author']['name']); | |
44 } | |
OLD | NEW |