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#29 from tcob/test
Tests
- Loading branch information
Showing
11 changed files
with
129 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
require_relative 'queries' | ||
require 'octokit' | ||
|
||
Dotenv.load('orgbot.env') | ||
|
||
# Simple Console Reporting or usage instructions | ||
class Reporter | ||
def initialize | ||
@prompt = TTY::Prompt.new | ||
@c = Octokit::Client.new(access_token: @t) | ||
@r = ENV['REPO'] | ||
@t = ENV['TOKEN'] | ||
end | ||
|
||
def welcome | ||
puts @c.say("Sup #{Query.new.user}") | ||
puts "\n🤖 Welcome to GitHub Simulator!"\ | ||
'Select how and when you would like to commit to GitHub:' | ||
end | ||
|
||
def configs | ||
puts 'Place configs in orgbot.env in the format:'\ | ||
'OCTOKIT_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'\ | ||
'REPO=someuseraccount/coolrepo' | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
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 +1,5 @@ | ||
require_relative 'test_dotenv' | ||
require_relative 'test_config' | ||
require_relative 'test_utils' | ||
require_relative 'test_reporter' | ||
require_relative 'test_queries' |
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 @@ | ||
require 'test/unit' | ||
require_relative '../lib/config' | ||
|
||
class TestConfig < Test::Unit::TestCase | ||
def test_repo | ||
conf = Config.new | ||
assert_nothing_raised do | ||
conf.validate_repo | ||
end | ||
end | ||
|
||
def test_token | ||
conf = Config.new | ||
assert_nothing_raised do | ||
conf.validate_token | ||
end | ||
end | ||
|
||
# requires user input, look into IO pipe here | ||
# to simulate gets | ||
# | ||
# def test_mode_select | ||
# conf = Config.new | ||
# assert_nothing_raised do | ||
# conf.mode_select | ||
# end | ||
# end | ||
# | ||
# def test_mode_select | ||
# conf = Config.new | ||
# assert_nothing_raised do | ||
# conf.mode_config | ||
# end | ||
# end | ||
# | ||
# def test_mode_select | ||
# conf = Config.new | ||
# assert_nothing_raised do | ||
# conf.checklist | ||
# 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,11 @@ | ||
require 'test/unit' | ||
require_relative '../lib/utils/queries' | ||
|
||
class TestConfig < Test::Unit::TestCase | ||
def test_user_login | ||
query = Query.new | ||
assert_nothing_raised do | ||
query.user | ||
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,11 @@ | ||
require 'test/unit' | ||
require_relative '../lib/utils/reporter' | ||
|
||
class TestReporter < Test::Unit::TestCase | ||
def test_welcome | ||
rep = Reporter.new | ||
assert_nothing_raised do | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'test/unit' | ||
require_relative '../lib/utils/utils' | ||
|
||
class TestUtils < Test::Unit::TestCase | ||
def test_ratelimit | ||
util = Util.new | ||
assert_nothing_raised do | ||
util.ratelimit | ||
end | ||
end | ||
|
||
def test_time_conversion | ||
util = Util.new | ||
expected = '50m 2s' | ||
assert_equal(expected, util.seconds_to_str(3002)) | ||
end | ||
end |