Skip to content

Commit 9ebc4fa

Browse files
AmandaCameronguyzmo
authored andcommitted
Implement a bunch of tests, disable the too_many_slashes in test_main
1 parent b569f22 commit 9ebc4fa

11 files changed

+367
-5
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"http_interactions": [
3+
{
4+
"recorded_at": "2017-08-06T19:11:26",
5+
"request": {
6+
"body": {
7+
"encoding": "utf-8",
8+
"string": ""
9+
},
10+
"headers": {
11+
"Accept": "application/json",
12+
"Accept-Encoding": "identity",
13+
"Authorization": "Basic X3VzZXJuYW1lX2JpdGJ1Y2tldDpfbmFtZXNwYWNlX2JpdGJ1Y2tldF8=",
14+
"Connection": "keep-alive",
15+
"From": "[email protected]",
16+
"User-Agent": "pybitbucket_fork/0.12.2 python-requests/2.18.1"
17+
},
18+
"method": "GET",
19+
"uri": "https://api.bitbucket.org/2.0/user"
20+
},
21+
"response": {
22+
"body": {
23+
"encoding": "utf-8",
24+
"string": ""
25+
},
26+
"headers": {
27+
"Connection": "keep-alive",
28+
"Content-Length": "0",
29+
"Content-Type": "text/html; charset=utf-8",
30+
"Date": "Sun, 06 Aug 2017 19:10:36 GMT",
31+
"ETag": "\"d41d8cd98f00b204e9800998ecf8427e\"",
32+
"Server": "nginx",
33+
"Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
34+
"WWW-Authenticate": "Basic realm=\"Bitbucket.org HTTP\"",
35+
"X-Frame-Options": "SAMEORIGIN",
36+
"X-Render-Time": "0.0180480480194",
37+
"X-Request-Count": "115",
38+
"X-Served-By": "app-139",
39+
"X-Static-Version": "fa732b7ad25b",
40+
"X-Version": "fa732b7ad25b"
41+
},
42+
"status": {
43+
"code": 401,
44+
"message": "Unauthorized"
45+
},
46+
"url": "https://api.bitbucket.org/2.0/user"
47+
}
48+
}
49+
],
50+
"recorded_with": "betamax/0.5.1"
51+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"http_interactions": [
3+
{
4+
"recorded_at": "2017-08-06T19:14:25",
5+
"request": {
6+
"body": {
7+
"encoding": "utf-8",
8+
"string": ""
9+
},
10+
"headers": {
11+
"Accept": "application/vnd.github.v3.full+json",
12+
"Accept-Charset": "utf-8",
13+
"Accept-Encoding": "identity",
14+
"Authorization": "token <PRIVATE_KEY_GITBUCKET>",
15+
"Connection": "keep-alive",
16+
"Content-Type": "application/json",
17+
"User-Agent": "github3.py/0.9.6"
18+
},
19+
"method": "GET",
20+
"uri": "http://localhost:8080/api/v3/user"
21+
},
22+
"response": {
23+
"body": {
24+
"encoding": "utf-8",
25+
"string": "404 page not found\n"
26+
},
27+
"headers": {
28+
"Content-Length": "19",
29+
"Content-Type": "text/plain; charset=utf-8",
30+
"Date": "Sun, 06 Aug 2017 19:14:25 GMT",
31+
"Set-Cookie": "CSRF-Token-IE7WA=wTj4QAW4PYsgCHSFAKwQGNuoXGa24wQV",
32+
"X-Content-Type-Options": "nosniff",
33+
"X-Syncthing-Id": "IE7WACV-EKPDZPW-7DN3BMO-P3TDKIR-QXNTDSC-JIR4EQS-6S3R5W4-IUQUJAO",
34+
"X-Syncthing-Version": "v0.14.26"
35+
},
36+
"status": {
37+
"code": 404,
38+
"message": "Not Found"
39+
},
40+
"url": "http://localhost:8080/api/v3/user"
41+
}
42+
}
43+
],
44+
"recorded_with": "betamax/0.5.1"
45+
}
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
{
2+
"http_interactions": [
3+
{
4+
"recorded_at": "2017-08-06T19:04:46",
5+
"request": {
6+
"body": {
7+
"encoding": "utf-8",
8+
"string": ""
9+
},
10+
"headers": {
11+
"Accept": "application/vnd.github.v3.full+json",
12+
"Accept-Charset": "utf-8",
13+
"Accept-Encoding": "identity",
14+
"Authorization": "token <PRIVATE_KEY_GITHUB>",
15+
"Connection": "keep-alive",
16+
"Content-Type": "application/json",
17+
"User-Agent": "github3.py/0.9.6"
18+
},
19+
"method": "GET",
20+
"uri": "https://api.github.com/user"
21+
},
22+
"response": {
23+
"body": {
24+
"encoding": "utf-8",
25+
"string": "{\"login\":\"AmandaCameron\",\"id\":114638,\"avatar_url\":\"https://avatars1.githubusercontent.com/u/114638?v=4\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/AmandaCameron\",\"html_url\":\"https://github.com/AmandaCameron\",\"followers_url\":\"https://api.github.com/users/AmandaCameron/followers\",\"following_url\":\"https://api.github.com/users/AmandaCameron/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/AmandaCameron/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/AmandaCameron/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/AmandaCameron/subscriptions\",\"organizations_url\":\"https://api.github.com/users/AmandaCameron/orgs\",\"repos_url\":\"https://api.github.com/users/AmandaCameron/repos\",\"events_url\":\"https://api.github.com/users/AmandaCameron/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/AmandaCameron/received_events\",\"type\":\"User\",\"site_admin\":false,\"name\":\"Amanda Cameron\",\"company\":null,\"blog\":\"http://amanda.darkdna.net\",\"location\":null,\"email\":null,\"hireable\":null,\"bio\":null,\"public_repos\":43,\"public_gists\":19,\"followers\":15,\"following\":0,\"created_at\":\"2009-08-12T16:15:59Z\",\"updated_at\":\"2017-07-20T03:24:22Z\"}"
26+
},
27+
"headers": {
28+
"Access-Control-Allow-Origin": "*",
29+
"Access-Control-Expose-Headers": "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
30+
"Cache-Control": "private, max-age=60, s-maxage=60",
31+
"Content-Length": "1198",
32+
"Content-Security-Policy": "default-src 'none'",
33+
"Content-Type": "application/json; charset=utf-8",
34+
"Date": "Sun, 06 Aug 2017 19:03:56 GMT",
35+
"ETag": "\"7ae175c9ad28b1045b3179886c2040ac\"",
36+
"Last-Modified": "Thu, 20 Jul 2017 03:24:22 GMT",
37+
"Server": "GitHub.com",
38+
"Status": "200 OK",
39+
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
40+
"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP",
41+
"X-Accepted-OAuth-Scopes": "",
42+
"X-Content-Type-Options": "nosniff",
43+
"X-Frame-Options": "deny",
44+
"X-GitHub-Media-Type": "github.v3; param=full; format=json",
45+
"X-GitHub-Request-Id": "ACED:5584:2294A6C:5270EDC:5987681C",
46+
"X-OAuth-Scopes": "repo, delete_repo, gist",
47+
"X-RateLimit-Limit": "5000",
48+
"X-RateLimit-Remaining": "4999",
49+
"X-RateLimit-Reset": "1502049836",
50+
"X-Runtime-rack": "0.040436",
51+
"X-XSS-Protection": "1; mode=block"
52+
},
53+
"status": {
54+
"code": 200,
55+
"message": "OK"
56+
},
57+
"url": "https://api.github.com/user"
58+
}
59+
},
60+
{
61+
"recorded_at": "2017-08-06T19:04:46",
62+
"request": {
63+
"body": {
64+
"encoding": "utf-8",
65+
"string": ""
66+
},
67+
"headers": {
68+
"Accept": "application/vnd.github.v3.full+json",
69+
"Accept-Charset": "utf-8",
70+
"Accept-Encoding": "identity",
71+
"Authorization": "token <PRIVATE_KEY_GITHUB>",
72+
"Connection": "keep-alive",
73+
"Content-Type": "application/json",
74+
"User-Agent": "github3.py/0.9.6"
75+
},
76+
"method": "GET",
77+
"uri": "https://api.github.com/repos/git-services/foo-bar/github-testing"
78+
},
79+
"response": {
80+
"body": {
81+
"encoding": "utf-8",
82+
"string": "{\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3\"}"
83+
},
84+
"headers": {
85+
"Access-Control-Allow-Origin": "*",
86+
"Access-Control-Expose-Headers": "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
87+
"Content-Length": "77",
88+
"Content-Security-Policy": "default-src 'none'",
89+
"Content-Type": "application/json; charset=utf-8",
90+
"Date": "Sun, 06 Aug 2017 19:03:56 GMT",
91+
"Server": "GitHub.com",
92+
"Status": "404 Not Found",
93+
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
94+
"X-Accepted-OAuth-Scopes": "repo",
95+
"X-Content-Type-Options": "nosniff",
96+
"X-Frame-Options": "deny",
97+
"X-GitHub-Media-Type": "github.v3; param=full; format=json",
98+
"X-GitHub-Request-Id": "ACED:5584:2294A78:5270EF8:5987681C",
99+
"X-OAuth-Scopes": "repo, delete_repo, gist",
100+
"X-RateLimit-Limit": "5000",
101+
"X-RateLimit-Remaining": "4998",
102+
"X-RateLimit-Reset": "1502049836",
103+
"X-Runtime-rack": "0.019213",
104+
"X-XSS-Protection": "1; mode=block"
105+
},
106+
"status": {
107+
"code": 404,
108+
"message": "Not Found"
109+
},
110+
"url": "https://api.github.com/repos/git-services/foo-bar/github-testing"
111+
}
112+
}
113+
],
114+
"recorded_with": "betamax/0.5.1"
115+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{
2+
"http_interactions": [
3+
{
4+
"recorded_at": "2017-08-06T18:57:42",
5+
"request": {
6+
"body": {
7+
"encoding": "utf-8",
8+
"string": ""
9+
},
10+
"headers": {
11+
"Accept": "*/*",
12+
"Accept-Encoding": "identity",
13+
"Connection": "keep-alive",
14+
"PRIVATE-TOKEN": "<PRIVATE_KEY_GITLAB>",
15+
"User-Agent": "python-requests/2.18.1"
16+
},
17+
"method": "GET",
18+
"uri": "https://gitlab.com/api/v3/user"
19+
},
20+
"response": {
21+
"body": {
22+
"encoding": null,
23+
"string": "{\"name\":\"Amanda Cameron\",\"username\":\"AmandaCameron\",\"id\":591747,\"state\":\"active\",\"avatar_url\":\"https://secure.gravatar.com/avatar/6977e7a51b06decd9b2ae6be9f633a02?s=80&d=identicon\",\"web_url\":\"https://gitlab.com/AmandaCameron\",\"created_at\":\"2016-06-23T16:54:06.799Z\",\"bio\":null,\"location\":null,\"skype\":\"\",\"linkedin\":\"\",\"twitter\":\"\",\"website_url\":\"\",\"organization\":null,\"last_sign_in_at\":\"2017-06-22T21:18:04.190Z\",\"confirmed_at\":\"2016-06-23T16:54:06.710Z\",\"last_activity_on\":\"2017-05-24\",\"email\":\"[email protected]\",\"color_scheme_id\":1,\"projects_limit\":100000,\"current_sign_in_at\":\"2017-08-04T19:08:12.530Z\",\"identities\":[{\"provider\":\"github\",\"extern_uid\":\"114638\"}],\"can_create_group\":true,\"can_create_project\":true,\"two_factor_enabled\":false,\"external\":false,\"shared_runners_minutes_limit\":null}"
24+
},
25+
"headers": {
26+
"Cache-Control": "max-age=0, private, must-revalidate",
27+
"Content-Length": "801",
28+
"Content-Type": "application/json",
29+
"Date": "Sun, 06 Aug 2017 18:56:52 GMT",
30+
"Etag": "W/\"90fe2c43890de56f17c2e1625d35b52c\"",
31+
"Server": "nginx",
32+
"Strict-Transport-Security": "max-age=31536000",
33+
"Vary": "Origin",
34+
"X-Frame-Options": "SAMEORIGIN",
35+
"X-Request-Id": "a2bc7cc9-d368-49eb-8ac2-64df01b8f2b0",
36+
"X-Runtime": "0.133790"
37+
},
38+
"status": {
39+
"code": 200,
40+
"message": "OK"
41+
},
42+
"url": "https://gitlab.com/api/v3/user"
43+
}
44+
},
45+
{
46+
"recorded_at": "2017-08-06T18:57:42",
47+
"request": {
48+
"body": {
49+
"encoding": "utf-8",
50+
"string": ""
51+
},
52+
"headers": {
53+
"Accept": "*/*",
54+
"Accept-Encoding": "identity",
55+
"Connection": "keep-alive",
56+
"PRIVATE-TOKEN": "<PRIVATE_KEY_GITLAB>",
57+
"User-Agent": "python-requests/2.18.1"
58+
},
59+
"method": "GET",
60+
"uri": "https://gitlab.com/api/v3/projects/git-repo-test%2Fsubgroup%2Ftest-repo"
61+
},
62+
"response": {
63+
"body": {
64+
"encoding": null,
65+
"string": "{\"message\":\"404 Project Not Found\"}"
66+
},
67+
"headers": {
68+
"Cache-Control": "no-cache",
69+
"Content-Length": "35",
70+
"Content-Type": "application/json",
71+
"Date": "Sun, 06 Aug 2017 18:56:52 GMT",
72+
"Server": "nginx",
73+
"Vary": "Origin",
74+
"X-Frame-Options": "SAMEORIGIN",
75+
"X-Request-Id": "b7e7823c-3bcf-4f8c-8f23-d466333d9974",
76+
"X-Runtime": "0.051197"
77+
},
78+
"status": {
79+
"code": 404,
80+
"message": "Not Found"
81+
},
82+
"url": "https://gitlab.com/api/v3/projects/git-repo-test%2Fsubgroup%2Ftest-repo"
83+
}
84+
}
85+
],
86+
"recorded_with": "betamax/0.5.1"
87+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"http_interactions": [
3+
{
4+
"recorded_at": "2017-08-06T19:07:26",
5+
"request": {
6+
"body": {
7+
"encoding": "utf-8",
8+
"string": ""
9+
},
10+
"headers": {
11+
"Accept": "*/*",
12+
"Accept-Encoding": "identity",
13+
"Connection": "keep-alive",
14+
"User-Agent": "python-requests/2.18.1"
15+
},
16+
"method": "GET",
17+
"uri": "<GOGS_URL>/api/v1/user?token=<PRIVATE_KEY_GOGS>"
18+
},
19+
"response": {
20+
"body": {
21+
"encoding": "utf-8",
22+
"string": ""
23+
},
24+
"headers": {
25+
"Content-Length": "0",
26+
"Content-Type": "text/plain; charset=utf-8",
27+
"Date": "Sun, 06 Aug 2017 19:06:36 GMT",
28+
"Server": "Caddy",
29+
"Set-Cookie": "lang=en-US; Path=/; Max-Age=2147483647"
30+
},
31+
"status": {
32+
"code": 401,
33+
"message": "Unauthorized"
34+
},
35+
"url": "<GOGS_URL>/api/v1/user?token=<PRIVATE_KEY_GOGS>"
36+
}
37+
}
38+
],
39+
"recorded_with": "betamax/0.5.1"
40+
}

tests/integration/test_bitbucket.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ def test_04_clone(self):
5555
self.action_clone(namespace='guyzmo',
5656
repository='git-repo')
5757

58+
def test_04_clone__too_many_slashes(self):
59+
with pytest.raises(ResourceNotFoundError):
60+
self.action_clone(namespace='guyzmo/sub-ns',
61+
repository = 'git-repo')
62+
5863
def test_05_add(self):
5964
self.action_add(namespace='guyzmo',
6065
repository='git-repo')

tests/integration/test_gitbucket.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ def test_04_clone(self):
8686
self.action_clone(namespace='root',
8787
repository='repo')
8888

89+
def test_04_clone__too_many_slashes(self):
90+
with pytest.raises(ResourceNotFoundError):
91+
self.action_clone(namespace='root/sub-ns',
92+
repository='repo')
93+
8994
def test_05_add(self):
9095
self.action_add(namespace='root',
9196
repository='repo')

tests/integration/test_github.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ def test_04_clone(self):
7272
self.action_clone(namespace='git-services',
7373
repository='github-testing')
7474

75+
def test_04_clone__too_many_slashes(self):
76+
with pytest.raises(ResourceNotFoundError):
77+
self.action_clone(namespace='git-services/foo-bar',
78+
repository = 'github-testing')
79+
7580
def test_05_add(self):
7681
self.action_add(namespace='guyzmo',
7782
repository='git-repo')

0 commit comments

Comments
 (0)