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
2 changed files
with
52 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
mock | ||
requests | ||
simplejson | ||
pygments |
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,2 +1,51 @@ | ||
# params = {"sortby": "points desc", "limit": 100, "start": 100} | ||
# params = {"filter[fields][create_ts]": "[2011-06-01T00:00:00.00Z TO 2011-06-02T23:59:00.00Z]"} | ||
""" | ||
Tests and such. | ||
""" | ||
|
||
from unittest import TestCase, main | ||
from mock import Mock | ||
|
||
from yc import cli | ||
from yc import core | ||
|
||
|
||
class CLI(TestCase): | ||
|
||
def setUp(self): | ||
core.req = Mock() | ||
self.parser = cli.create_parser() | ||
|
||
def test_empy_parser(self): | ||
args = [] | ||
options = self.parser.parse_args(args) | ||
self.assertTrue(isinstance(options.search, list)) | ||
|
||
def test_parser_can_handle_multiple_search_terms(self): | ||
args = ['one', 'two', 'three'] | ||
options = self.parser.parse_args(args) | ||
self.assertEquals(options.search, args) | ||
|
||
def test_parser_recognizes_limit_and_start_options(self): | ||
args = ['term', '-n', '50', '-s', '100'] | ||
options = self.parser.parse_args(args) | ||
self.assertEquals(options.limit, 50) | ||
self.assertEquals(options.start, 100) | ||
|
||
def test_parser_can_recognize_dates(self): | ||
args = ['', '-d', '03-16-12'] | ||
options = self.parser.parse_args(args) | ||
self.assertEquals(options.day, '03-16-12') | ||
args = ['', '-d', '2012-03-16'] | ||
options = self.parser.parse_args(args) | ||
self.assertEquals(options.day, '2012-03-16') | ||
|
||
def test_parser_recognizes_hits_flag(self): | ||
args = ['github', '--hits'] | ||
options = self.parser.parse_args(args) | ||
self.assertTrue(options.hits) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() | ||
# params = {"sortby": "points desc", "limit": 100, "start": 100} | ||
# params = {"filter[fields][create_ts]": "[2011-06-01T00:00:00.00Z TO 2011-06-02T23:59:00.00Z]"} |