forked from yeoman/yeoman
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 yeoman#509 from gnuwilliam/insight-tests
Insight tests
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env python | ||
|
||
import sys | ||
import unittest | ||
import os | ||
|
||
sys.path.append('../bin/') | ||
|
||
from yeomaninsight import main, Analytics | ||
|
||
class YeomanInsightTest(unittest.TestCase): | ||
|
||
def test_init_should_error_when_no_tracking_code_is_passed(self): | ||
self.assertRaises(Exception, Analytics, tracking_code='') | ||
|
||
def test_main_should_error_when_arguments_are_less_than_two(self): | ||
# temporally disables print function, because it's used on main. | ||
# just to keep the tests output clean. | ||
sys.stdout = open(os.devnull, 'w') | ||
self.assertRaises(SystemExit, main, args='') | ||
# restores print function. | ||
sys.stdout = sys.__stdout__ | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |