#!/usr/bin/env python
import unittest
import yv_suggest.open as yvs
import inspect

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

    def test_url(self):
        '''should build correct URL to Bible reference'''
        url = yvs.get_ref_url('esv/jhn.3.16')
        self.assertEqual(url, 'https://www.bible.com/bible/esv/jhn.3.16')

    def test_query_param(self):
        '''should use received query parameter as default ref ID'''
        spec = inspect.getargspec(yvs.main)
        default_query_str = spec.defaults[0]
        self.assertEqual(default_query_str, '{query}')

@@ -77,16 +77,191 @@
 nspect%0A%0A
+class WebbrowserMock(object):%0A    '''mock the builtin webbrowser module'''%0A%0A    def open(self, url):%0A        '''mock the webbrowser.open() function'''%0A        self.url = url%0A%0A
 class Op
@@ -791,8 +791,282 @@
 uery%7D')%0A
+%0A    def test_url_open(self):%0A        '''should attempt to open URL using webbrowser module'''%0A        mock = self.WebbrowserMock()%0A        yvs.webbrowser = mock%0A        yvs.main('nlt/jhn.3.17')%0A        self.assertEqual(mock.url, 'https://www.bible.com/bible/nlt/jhn.3.17')%0A

Add unit test for opening bible reference urls