@@ -36,6 +36,47 @@ def setUp(self):
36
36
"pull": true
37
37
}
38
38
}"""
39
+ self .repos_list_json_str = """[{
40
+ "id": 27,
41
+ "owner": {
42
+ "id": 1,
43
+ "username": "unknwon",
44
+ "full_name": "",
45
+ "email": "u@gogs.io",
46
+ "avatar_url": "/avatars/1"
47
+ },
48
+ "full_name": "unknwon/Hello-World",
49
+ "private": false,
50
+ "fork": false,
51
+ "html_url": "http://localhost:3000/unknwon/Hello-World",
52
+ "clone_url": "http://localhost:3000/unknwon/hello-world.git",
53
+ "ssh_url": "jiahuachen@localhost:unknwon/hello-world.git",
54
+ "permissions": {
55
+ "admin": true,
56
+ "push": true,
57
+ "pull": true
58
+ }
59
+ },{
60
+ "id": 28,
61
+ "owner": {
62
+ "id": 1,
63
+ "username": "unknwon",
64
+ "full_name": "",
65
+ "email": "u@gogs.io",
66
+ "avatar_url": "/avatars/1"
67
+ },
68
+ "full_name": "unknwon/Hello-World-Again",
69
+ "private": false,
70
+ "fork": false,
71
+ "html_url": "http://localhost:3000/unknwon/Hello-World-Again",
72
+ "clone_url": "http://localhost:3000/unknwon/hello-world-again.git",
73
+ "ssh_url": "jiahuachen@localhost:unknwon/hello-world-again.git",
74
+ "permissions": {
75
+ "admin": true,
76
+ "push": true,
77
+ "pull": true
78
+ }
79
+ }]"""
39
80
self .user_json_str = """{
40
81
"id": 1,
41
82
"username": "unknwon",
@@ -183,6 +224,15 @@ def test_get_repo1(self):
183
224
last_call = responses .calls [1 ]
184
225
self .assertEqual (last_call .request .url , self .path_with_token (uri2 ))
185
226
227
+ @responses .activate
228
+ def test_get_user_repos (self ):
229
+ uri = self .path ("/users/username/repos" )
230
+ responses .add (responses .GET , uri , body = self .repos_list_json_str , status = 200 )
231
+ repos = self .client .get_user_repos (self .token , "username" )
232
+ self .assertEqual (len (repos ), 2 )
233
+ self .assert_repos_equal (repos [0 ], self .expected_repo )
234
+
235
+
186
236
@responses .activate
187
237
def test_delete_repo1 (self ):
188
238
uri1 = self .path ("/repos/username/repo1" )
0 commit comments