Skip to content

Commit

Permalink
Merge branch 'feature/open'
Browse files Browse the repository at this point in the history
  • Loading branch information
caleb531 committed Jan 19, 2015
2 parents 8573f64 + 406eb15 commit 5932cbe
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_open.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
import yv_suggest.open as yvs
import inspect

class WebbrowserMock(object):
'''mock the builtin webbrowser module'''

def open(self, url):
'''mock the webbrowser.open() function'''
self.url = url

class OpenTestCase(unittest.TestCase):
'''test the handling of Bible reference URLs'''

Expand All @@ -16,3 +23,10 @@ def test_query_param(self):
spec = inspect.getargspec(yvs.main)
default_query_str = spec.defaults[0]
self.assertEqual(default_query_str, '{query}')

def test_url_open(self):
'''should attempt to open URL using webbrowser module'''
mock = self.WebbrowserMock()
yvs.webbrowser = mock
yvs.main('nlt/jhn.3.17')
self.assertEqual(mock.url, 'https://www.bible.com/bible/nlt/jhn.3.17')

0 comments on commit 5932cbe

Please sign in to comment.