-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
112 changed files
with
4,668 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
defmodule Tentacat.Commits.CommentsTest do | ||
use ExUnit.Case, async: false | ||
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney | ||
import Tentacat.Commits.Comments | ||
|
||
doctest Tentacat.Commits.Comments | ||
|
||
@client Tentacat.Client.new(%{access_token: "8e663c8614ced27c09b963f806ac46776a29db50"}) | ||
|
||
setup_all do | ||
HTTPoison.start | ||
end | ||
|
||
test "list_all/3" do | ||
use_cassette "commits/comments#list_all" do | ||
assert list_all("tentatest", "tentacat", @client) == [] | ||
end | ||
end | ||
|
||
test "list/4" do | ||
use_cassette "commits/comments#list" do | ||
assert list("soudqwiggle", "elixir-conspiracy", "b426f957a26cd4d632da3b174372c973ab083523", @client) == [] | ||
end | ||
end | ||
|
||
test "find/4" do | ||
use_cassette "commits/comments#find" do | ||
%{"body" => body} = find("soudqwiggle", "elixir-conspiracy", 15079374, @client) | ||
assert body == ":sheep: :lv:" | ||
end | ||
end | ||
|
||
test "create/5" do | ||
body = %{ | ||
"body" => ":sheep: :it:", | ||
"path" => "README.md", | ||
"position" => 1 | ||
} | ||
use_cassette "commits/comments#create" do | ||
{status_code, _} = create("soudqwiggle", "elixir-conspiracy", "b426f957a26cd4d632da3b174372c973ab083523", body, @client) | ||
assert status_code == 201 | ||
end | ||
end | ||
|
||
test "update/5" do | ||
body = %{ | ||
"body" => ":sheep: :lv:" | ||
} | ||
use_cassette "commits/comments#update" do | ||
%{"id" => commit_id} = update("soudqwiggle", "elixir-conspiracy", 15079374, body, @client) | ||
assert commit_id == 15079374 | ||
end | ||
end | ||
|
||
test "delete/4" do | ||
use_cassette "commits/comments#delete" do | ||
{status_code, _} = delete("soudqwiggle", "elixir-conspiracy", 15079374, @client) | ||
assert status_code == 204 | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
defmodule Tentacat.ContentsTest do | ||
use ExUnit.Case, async: false | ||
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney | ||
import Tentacat.Contents | ||
|
||
doctest Tentacat.Contents | ||
|
||
@client Tentacat.Client.new(%{access_token: "yourtokencomeshere"}) | ||
|
||
setup_all do | ||
HTTPoison.start | ||
end | ||
|
||
test "find/4" do | ||
use_cassette "contents#find" do | ||
[%{"sha" => sha}] = find("elixir-lang", "elixir", "lib", @client) | ||
assert sha == "c928b5d4c7fa3c0c665cb2d2f591def3bdf29c38" | ||
end | ||
end | ||
|
||
test "find_in/5" do | ||
use_cassette "contents#find_in" do | ||
[%{"sha" => sha}] = find_in("elixir-lang", "elixir", "lib", "master", @client) | ||
assert sha == "c928b5d4c7fa3c0c665cb2d2f591def3bdf29c38" | ||
end | ||
end | ||
|
||
test "create/5" do | ||
body = %{ | ||
"message" => "Initial commit", | ||
"committer" => %{ | ||
"name" => "Soud Qwiggle", | ||
"email"=> "soud@qwiggle.com" | ||
}, | ||
"content" => Base.encode64("# Yoop!"), | ||
"branch"=> "master" | ||
} | ||
use_cassette "contents#create" do | ||
{status_code, _} = create("soudqwiggle", "elixir-conspiracy", "README.md", body, @client) | ||
assert status_code == 201 | ||
end | ||
end | ||
|
||
test "update/5" do | ||
body = %{ | ||
"message" => "commit after the initial commit", | ||
"committer" => %{ | ||
"name" => "Soud Qwiggle", | ||
"email"=> "soud@qwiggle.com" | ||
}, | ||
"content" => Base.encode64("## Woop!"), | ||
"sha" => "f6147c986f215f640f86f4e337748e3a311bf281", | ||
"branch"=> "master" | ||
} | ||
use_cassette "contents#update" do | ||
%{"commit" => %{"sha" => sha}} = update("soudqwiggle", "elixir-conspiracy", "README.md", body, @client) | ||
assert sha == "bf7c4ab53fe7503b82b9654d5979ebe8c24ea009" | ||
end | ||
end | ||
|
||
test "remove/5" do | ||
body = %{ | ||
"message" => "remove readme", | ||
"committer" => %{ | ||
"name" => "Soud Qwiggle", | ||
"email"=> "soud@qwiggle.com" | ||
}, | ||
"sha" => "c2fb5f1db1767d8f1435952f640ac8e385612482", | ||
"branch"=> "master" | ||
} | ||
use_cassette "contents#remove" do | ||
%{"commit"=>%{"sha"=>sha}} = remove("soudqwiggle", "elixir-conspiracy", "README.md", body, @client) | ||
assert sha == "2ff6f7942773c268dc9ab0e11e9dffad402c1860" | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
[ | ||
{ | ||
"request": { | ||
"body": "{\"body\":\":sheep: :it:\",\"path\":\"README.md\",\"position\":1}", | ||
"headers": { | ||
"User-agent": "tentacat", | ||
"Authorization": "token yourtokencomeshere" | ||
}, | ||
"method": "post", | ||
"options": [], | ||
"request_body": "", | ||
"url": "https://api.github.com/repos/soudqwiggle/elixir-conspiracy/commits/b426f957a26cd4d632da3b174372c973ab083523/comments" | ||
}, | ||
"response": { | ||
"body": "{\"url\":\"https://api.github.com/repos/soudqwiggle/elixir-conspiracy/comments/15084673\",\"html_url\":\"https://github.com/soudqwiggle/elixir-conspiracy/commit/b426f957a26cd4d632da3b174372c973ab083523#commitcomment-15084673\",\"id\":15084673,\"user\":{\"login\":\"soudqwiggle\",\"id\":16187637,\"avatar_url\":\"https://avatars.githubusercontent.com/u/16187637?v=3\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/soudqwiggle\",\"html_url\":\"https://github.com/soudqwiggle\",\"followers_url\":\"https://api.github.com/users/soudqwiggle/followers\",\"following_url\":\"https://api.github.com/users/soudqwiggle/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/soudqwiggle/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/soudqwiggle/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/soudqwiggle/subscriptions\",\"organizations_url\":\"https://api.github.com/users/soudqwiggle/orgs\",\"repos_url\":\"https://api.github.com/users/soudqwiggle/repos\",\"events_url\":\"https://api.github.com/users/soudqwiggle/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/soudqwiggle/received_events\",\"type\":\"User\",\"site_admin\":false},\"position\":1,\"line\":null,\"path\":\"README.md\",\"commit_id\":\"b426f957a26cd4d632da3b174372c973ab083523\",\"created_at\":\"2015-12-20T09:22:00Z\",\"updated_at\":\"2015-12-20T09:22:00Z\",\"body\":\":sheep: :it:\"}", | ||
"headers": { | ||
"Server": "GitHub.com", | ||
"Date": "Sun, 20 Dec 2015 09:22:00 GMT", | ||
"Content-Type": "application/json; charset=utf-8", | ||
"Content-Length": "1344", | ||
"Status": "201 Created", | ||
"X-RateLimit-Limit": "5000", | ||
"X-RateLimit-Remaining": "4998", | ||
"X-RateLimit-Reset": "1450606885", | ||
"Cache-Control": "private, max-age=60, s-maxage=60", | ||
"ETag": "\"f2002c5e6017d69d476d8e21e31f3bc0\"", | ||
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user", | ||
"X-Accepted-OAuth-Scopes": "", | ||
"Location": "https://api.github.com/repos/soudqwiggle/elixir-conspiracy/comments/15084673", | ||
"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", | ||
"X-GitHub-Media-Type": "github.v3; format=json", | ||
"Access-Control-Allow-Credentials": "true", | ||
"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", | ||
"Access-Control-Allow-Origin": "*", | ||
"Content-Security-Policy": "default-src 'none'", | ||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", | ||
"X-Content-Type-Options": "nosniff", | ||
"X-Frame-Options": "deny", | ||
"X-XSS-Protection": "1; mode=block", | ||
"X-Served-By": "b0ef53392caa42315c6206737946d931", | ||
"X-GitHub-Request-Id": "3E552BA7:A39B:1462E87E:56767338" | ||
}, | ||
"status_code": 201, | ||
"type": "ok" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
[ | ||
{ | ||
"request": { | ||
"body": "\"\"", | ||
"headers": { | ||
"User-agent": "tentacat", | ||
"Authorization": "token yourtokencomeshere" | ||
}, | ||
"method": "delete", | ||
"options": [], | ||
"request_body": "", | ||
"url": "https://api.github.com/repos/soudqwiggle/elixir-conspiracy/comments/15079374" | ||
}, | ||
"response": { | ||
"body": "#Reference<0.0.4.8>", | ||
"headers": { | ||
"Server": "GitHub.com", | ||
"Date": "Sat, 19 Dec 2015 06:55:59 GMT", | ||
"Status": "204 No Content", | ||
"X-RateLimit-Limit": "5000", | ||
"X-RateLimit-Remaining": "4988", | ||
"X-RateLimit-Reset": "1450510991", | ||
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user", | ||
"X-Accepted-OAuth-Scopes": "", | ||
"X-GitHub-Media-Type": "github.v3; format=json", | ||
"Access-Control-Allow-Credentials": "true", | ||
"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", | ||
"Access-Control-Allow-Origin": "*", | ||
"Content-Security-Policy": "default-src 'none'", | ||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", | ||
"X-Content-Type-Options": "nosniff", | ||
"X-Frame-Options": "deny", | ||
"X-XSS-Protection": "1; mode=block", | ||
"Vary": "Accept-Encoding", | ||
"X-Served-By": "474556b853193c38f1b14328ce2d1b7d", | ||
"X-GitHub-Request-Id": "3E552BA7:14B62:11E05A37:5674FF7E" | ||
}, | ||
"status_code": 204, | ||
"type": "ok" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
[ | ||
{ | ||
"request": { | ||
"body": "\"\"", | ||
"headers": { | ||
"User-agent": "tentacat", | ||
"Authorization": "token yourtokencomeshere" | ||
}, | ||
"method": "get", | ||
"options": [], | ||
"request_body": "", | ||
"url": "https://api.github.com/repos/soudqwiggle/elixir-conspiracy/comments/15079374" | ||
}, | ||
"response": { | ||
"body": "{\"url\":\"https://api.github.com/repos/soudqwiggle/elixir-conspiracy/comments/15079374\",\"html_url\":\"https://github.com/soudqwiggle/elixir-conspiracy/commit/b426f957a26cd4d632da3b174372c973ab083523#commitcomment-15079374\",\"id\":15079374,\"user\":{\"login\":\"soudqwiggle\",\"id\":16187637,\"avatar_url\":\"https://avatars.githubusercontent.com/u/16187637?v=3\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/soudqwiggle\",\"html_url\":\"https://github.com/soudqwiggle\",\"followers_url\":\"https://api.github.com/users/soudqwiggle/followers\",\"following_url\":\"https://api.github.com/users/soudqwiggle/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/soudqwiggle/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/soudqwiggle/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/soudqwiggle/subscriptions\",\"organizations_url\":\"https://api.github.com/users/soudqwiggle/orgs\",\"repos_url\":\"https://api.github.com/users/soudqwiggle/repos\",\"events_url\":\"https://api.github.com/users/soudqwiggle/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/soudqwiggle/received_events\",\"type\":\"User\",\"site_admin\":false},\"position\":1,\"line\":null,\"path\":\"README.md\",\"commit_id\":\"b426f957a26cd4d632da3b174372c973ab083523\",\"created_at\":\"2015-12-19T06:49:35Z\",\"updated_at\":\"2015-12-19T06:52:58Z\",\"body\":\":sheep: :lv:\"}", | ||
"headers": { | ||
"Server": "GitHub.com", | ||
"Date": "Sat, 19 Dec 2015 06:55:01 GMT", | ||
"Content-Type": "application/json; charset=utf-8", | ||
"Content-Length": "1344", | ||
"Status": "200 OK", | ||
"X-RateLimit-Limit": "5000", | ||
"X-RateLimit-Remaining": "4989", | ||
"X-RateLimit-Reset": "1450510991", | ||
"Cache-Control": "private, max-age=60, s-maxage=60", | ||
"Last-Modified": "Sat, 19 Dec 2015 06:52:58 GMT", | ||
"ETag": "\"e5116d2d3c79b23cf73426bda2c49d24\"", | ||
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user", | ||
"X-Accepted-OAuth-Scopes": "", | ||
"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", | ||
"X-GitHub-Media-Type": "github.v3; format=json", | ||
"Access-Control-Allow-Credentials": "true", | ||
"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", | ||
"Access-Control-Allow-Origin": "*", | ||
"Content-Security-Policy": "default-src 'none'", | ||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", | ||
"X-Content-Type-Options": "nosniff", | ||
"X-Frame-Options": "deny", | ||
"X-XSS-Protection": "1; mode=block", | ||
"X-Served-By": "d0b3c2c33a23690498aa8e70a435a259", | ||
"X-GitHub-Request-Id": "3E552BA7:A396:5205883:5674FF44" | ||
}, | ||
"status_code": 200, | ||
"type": "ok" | ||
} | ||
} | ||
] |
Oops, something went wrong.