Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit 81d032c

Browse files
committed
Add way to test end response from GitHub
1 parent ee58d84 commit 81d032c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

service_test.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# Example:
1212
#
1313
# $ SLACK_WEBHOOK_URL="http://..." bundle exec ruby service_test.rb
14+
# $ GITHUBPULLREQUESTS_OAUTH_TOKEN=06083a4a060d358ca709939b1f00645777661c44 bundle exec ruby service_test.rb
1415
#
1516
# Other Environment variables used:
1617
#
@@ -36,7 +37,7 @@ def initialize(klass, *params)
3637
@params = params
3738
end
3839

39-
def test
40+
def test(payload = {})
4041
config = {}
4142

4243
puts "-"*80
@@ -55,7 +56,7 @@ def test
5556
puts " -> #{config.inspect}"
5657
print " => "
5758

58-
test_service(@klass, config)
59+
test_service(@klass, config, payload)
5960
end
6061

6162
private
@@ -64,10 +65,10 @@ def to_env_var(param)
6465
"#{@klass.to_s.split("::").last}_#{param}".upcase
6566
end
6667

67-
def test_service(klass, config)
68+
def test_service(klass, config, payload)
6869
repo_name = ENV["REPO_NAME"] || "App"
6970

70-
service = klass.new(config, name: :test, repo_name: repo_name)
71+
service = klass.new(config, { name: :test, repo_name: repo_name }.merge(payload))
7172

7273
CC::Service::Invocation.new(service) do |i|
7374
i.wrap(WithResponseLogging)
@@ -79,3 +80,4 @@ def test_service(klass, config)
7980
ServiceTest.new(CC::Service::Flowdock, :api_token).test
8081
ServiceTest.new(CC::Service::Jira, :username, :password, :domain, :project_id).test
8182
ServiceTest.new(CC::Service::Asana, :api_key, :workspace_id, :project_id).test
83+
ServiceTest.new(CC::Service::GitHubPullRequests, :oauth_token).test({ github_slug: "codeclimate/codeclimate" })

0 commit comments

Comments
 (0)