11
11
# Example:
12
12
#
13
13
# $ SLACK_WEBHOOK_URL="http://..." bundle exec ruby service_test.rb
14
+ # $ GITHUBPULLREQUESTS_OAUTH_TOKEN=06083a4a060d358ca709939b1f00645777661c44 bundle exec ruby service_test.rb
14
15
#
15
16
# Other Environment variables used:
16
17
#
@@ -36,7 +37,7 @@ def initialize(klass, *params)
36
37
@params = params
37
38
end
38
39
39
- def test
40
+ def test ( payload = { } )
40
41
config = { }
41
42
42
43
puts "-" *80
@@ -55,7 +56,7 @@ def test
55
56
puts " -> #{ config . inspect } "
56
57
print " => "
57
58
58
- test_service ( @klass , config )
59
+ test_service ( @klass , config , payload )
59
60
end
60
61
61
62
private
@@ -64,10 +65,10 @@ def to_env_var(param)
64
65
"#{ @klass . to_s . split ( "::" ) . last } _#{ param } " . upcase
65
66
end
66
67
67
- def test_service ( klass , config )
68
+ def test_service ( klass , config , payload )
68
69
repo_name = ENV [ "REPO_NAME" ] || "App"
69
70
70
- service = klass . new ( config , name : :test , repo_name : repo_name )
71
+ service = klass . new ( config , { name : :test , repo_name : repo_name } . merge ( payload ) )
71
72
72
73
CC ::Service ::Invocation . new ( service ) do |i |
73
74
i . wrap ( WithResponseLogging )
@@ -79,3 +80,4 @@ def test_service(klass, config)
79
80
ServiceTest . new ( CC ::Service ::Flowdock , :api_token ) . test
80
81
ServiceTest . new ( CC ::Service ::Jira , :username , :password , :domain , :project_id ) . test
81
82
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