forked from bsmth/orgbots
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request bsmth#30 from tcob/test
Add More Test
- Loading branch information
Showing
17 changed files
with
141 additions
and
33 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
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
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
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 |
---|---|---|
|
@@ -27,4 +27,8 @@ def user | |
@c = Octokit::Client.new(access_token: @t) | ||
@c.user[:login] | ||
end | ||
|
||
def hooks | ||
@c.hooks(@repo) | ||
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
require_relative 'test_dotenv' | ||
require_relative 'test_branches' | ||
require_relative 'test_config' | ||
require_relative 'test_utils' | ||
require_relative 'test_reporter' | ||
require_relative 'test_dotenv' | ||
require_relative 'test_issues' | ||
require_relative 'test_pull_requests' | ||
require_relative 'test_queries' | ||
require_relative 'test_reporter' | ||
require_relative 'test_utils' |
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,25 @@ | ||
# rubocop:disable Metrics/MethodLength | ||
|
||
# Temporarily redirects STDOUT and STDERR to /dev/null | ||
# but does print exceptions should there occur any. | ||
# Call as: | ||
# suppress_output { puts 'never printed' } | ||
# | ||
def suppress_output | ||
begin | ||
original_stderr = $stderr.clone | ||
original_stdout = $stdout.clone | ||
$stderr.reopen(File.new('/dev/null', 'w')) | ||
$stdout.reopen(File.new('/dev/null', 'w')) | ||
retval = yield | ||
rescue StandardError => e | ||
$stdout.reopen(original_stdout) | ||
$stderr.reopen(original_stderr) | ||
raise e | ||
ensure | ||
$stdout.reopen(original_stdout) | ||
$stderr.reopen(original_stderr) | ||
end | ||
retval | ||
end | ||
# rubocop:enable Metrics/MethodLength |
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,21 @@ | ||
require 'test/unit' | ||
require 'dotenv/load' | ||
require_relative '../lib/utils/brancher' | ||
|
||
Dotenv.load('orgbot.env') | ||
|
||
class TestBranches < Test::Unit::TestCase | ||
def test_list_branches | ||
brancher = BranchBot.new(ENV['REPO'], ENV['TOKEN']) | ||
assert_nothing_raised do | ||
puts brancher.list_branches | ||
end | ||
end | ||
|
||
def test_rand_branch | ||
brancher = BranchBot.new(ENV['REPO'], ENV['TOKEN']) | ||
assert_nothing_raised do | ||
puts brancher.rand_branch | ||
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,28 @@ | ||
require 'test/unit' | ||
require 'dotenv/load' | ||
require_relative '../lib/utils/issues' | ||
|
||
Dotenv.load('orgbot.env') | ||
|
||
class TestIssues < Test::Unit::TestCase | ||
def test_list_issues | ||
issue = IssueBot.new(ENV['REPO'], ENV['TOKEN']) | ||
assert_nothing_raised do | ||
issue.list_issues | ||
end | ||
end | ||
|
||
def test_list_open_issues | ||
issue = IssueBot.new(ENV['REPO'], ENV['TOKEN']) | ||
assert_nothing_raised do | ||
issue.open_issues | ||
end | ||
end | ||
|
||
def test_list_closed_issues | ||
issue = IssueBot.new(ENV['REPO'], ENV['TOKEN']) | ||
assert_nothing_raised do | ||
issue.closed_issues | ||
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,22 @@ | ||
require 'test/unit' | ||
require 'dotenv/load' | ||
require_relative 'suppress_output' | ||
require_relative '../lib/utils/pullrequest' | ||
|
||
Dotenv.load('orgbot.env') | ||
|
||
class TestPullRequest < Test::Unit::TestCase | ||
def test_open_prs | ||
pr = PRBot.new(ENV['REPO'], ENV['TOKEN']) | ||
assert_nothing_raised do | ||
suppress_output { pr.open_prs } | ||
end | ||
end | ||
|
||
def test_all_pr_comments | ||
pr = PRBot.new(ENV['REPO'], ENV['TOKEN']) | ||
assert_nothing_raised do | ||
suppress_output { pr.all_pr_comments } | ||
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
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 |
---|---|---|
@@ -1,11 +1,12 @@ | ||
require 'test/unit' | ||
require_relative 'suppress_output' | ||
require_relative '../lib/utils/reporter' | ||
|
||
class TestReporter < Test::Unit::TestCase | ||
def test_welcome | ||
rep = Reporter.new | ||
assert_nothing_raised do | ||
rep.welcome | ||
suppress_output { rep.welcome } | ||
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