def test_result_subtitles():
    '''should set result subtitles as snippet of reference content'''
    results = yvs.get_result_list('love others')
    nose.assert_equal(len(results), 3)
    nose.assert_regexp_matches(results[0]['subtitle'], 'Lorem')
    nose.assert_regexp_matches(results[1]['subtitle'], 'consectetur')
    nose.assert_regexp_matches(results[2]['subtitle'], 'Ut aliquam')
def test_result_titles():
    """should correctly parse result titles from HTML"""
    results = yvs.get_result_list('love others')
    nose.assert_regexp_matches(results[0]['title'], r'^Romans 13:8 \(NIV\)')
    nose.assert_regexp_matches(results[1]['title'], r'^John 15:12 \(NIV\)')
    nose.assert_regexp_matches(results[2]['title'], r'^1 Peter 4:8 \(NIV\)')
    nose.assert_equal(len(results), 3)
示例#3
0
def test_result_subtitles():
    """should correctly parse result subtitles from HTML"""
    results = yvs.get_result_list('love others')
    nose.assert_regexp_matches(results[0]['subtitle'], 'Lorem')
    nose.assert_regexp_matches(results[1]['subtitle'], 'consectetur')
    nose.assert_regexp_matches(results[2]['subtitle'], 'Ut aliquam')
    nose.assert_equal(len(results), 3)
示例#4
0
def test_result_arg():
    """should correctly parse result UID arguments from HTML"""
    results = yvs.get_result_list('love others')
    nose.assert_equal(results[0]['arg'], '111/rom.13.8')
    nose.assert_equal(results[1]['arg'], '111/jhn.15.12')
    nose.assert_equal(results[2]['arg'], '111/1pe.4.8')
    nose.assert_equal(len(results), 3)
def test_result_subtitles():
    '''should set result subtitles as snippet of reference content'''
    results = yvs.get_result_list('love others')
    nose.assert_equal(len(results), 3)
    nose.assert_regexp_matches(results[0]['subtitle'], 'Lorem')
    nose.assert_regexp_matches(results[1]['subtitle'], 'consectetur')
    nose.assert_regexp_matches(results[2]['subtitle'], 'Ut aliquam')
def test_unicode_input(Request):
    '''should not raise exception when input contains non-ASCII characters'''
    results = yvs.get_result_list('é')
    Request.assert_called_once_with(
        'https://www.bible.com/search/bible?q=%C3%A9&version_id=111',
        headers=ANY)
    nose.assert_equal(len(results), 3)
def test_result_subtitles():
    """should correctly parse result subtitles from HTML"""
    results = yvs.get_result_list('love others')
    nose.assert_regexp_matches(results[0]['subtitle'], 'Lorem')
    nose.assert_regexp_matches(results[1]['subtitle'], 'consectetur')
    nose.assert_regexp_matches(results[2]['subtitle'], 'Ut aliquam')
    nose.assert_equal(len(results), 3)
def test_result_titles():
    '''should set result titles as full reference identifiers'''
    results = yvs.get_result_list('love others')
    nose.assert_equal(len(results), 3)
    nose.assert_regexp_matches(results[0]['title'], 'Romans 13:8 \(NIV\)')
    nose.assert_regexp_matches(results[1]['title'], 'John 15:12 \(NIV\)')
    nose.assert_regexp_matches(results[2]['title'], '1 Peter 4:8 \(NIV\)')
def test_result_arg():
    """should correctly parse result UID arguments from HTML"""
    results = yvs.get_result_list('love others')
    nose.assert_equal(results[0]['arg'], '111/rom.13.8')
    nose.assert_equal(results[1]['arg'], '111/jhn.15.12')
    nose.assert_equal(results[2]['arg'], '111/1pe.4.8')
    nose.assert_equal(len(results), 3)
def test_unicode_input(Request):
    '''should not raise exception when input contains non-ASCII characters'''
    results = yvs.get_result_list('é')
    Request.assert_called_once_with(
        'https://www.bible.com/search/bible?q=%C3%A9&version_id=111',
        headers=ANY)
    nose.assert_equal(len(results), 3)
示例#11
0
def test_result_titles():
    """should correctly parse result titles from HTML"""
    results = yvs.get_result_list('love others')
    nose.assert_regexp_matches(results[0]['title'], r'^Romans 13:8 \(NIV\)')
    nose.assert_regexp_matches(results[1]['title'], r'^John 15:12 \(NIV\)')
    nose.assert_regexp_matches(results[2]['title'], r'^1 Peter 4:8 \(NIV\)')
    nose.assert_equal(len(results), 3)
def test_result_titles():
    '''should set result titles as full reference identifiers'''
    results = yvs.get_result_list('love others')
    nose.assert_equal(len(results), 3)
    nose.assert_regexp_matches(results[0]['title'], 'Romans 13:8 \(NIV\)')
    nose.assert_regexp_matches(results[1]['title'], 'John 15:12 \(NIV\)')
    nose.assert_regexp_matches(results[2]['title'], '1 Peter 4:8 \(NIV\)')
def test_output(out):
    """should output result list XML"""
    query_str = 'love others'
    yvs.main(query_str)
    output = out.getvalue().strip()
    results = yvs.get_result_list(query_str)
    xml = yvs.shared.get_result_list_xml(results).strip()
    nose.assert_equal(output, xml)
def test_output(out):
    """should output result list XML"""
    query_str = 'love others'
    yvs.main(query_str)
    output = out.getvalue().strip()
    results = yvs.get_result_list(query_str)
    xml = yvs.shared.get_result_list_xml(results).strip()
    nose.assert_equal(output, xml)
def test_output(out):
    """should output result list JSON"""
    query_str = 'love others'
    yvs.main(query_str)
    output = out.getvalue().rstrip()
    results = yvs.get_result_list(query_str)
    feedback = yvs.core.get_result_list_feedback_str(results).rstrip()
    nose.assert_equal(output, feedback)
示例#16
0
def test_output(out):
    """should output result list JSON"""
    query_str = 'love others'
    yvs.main(query_str)
    output = out.getvalue().rstrip()
    results = yvs.get_result_list(query_str)
    feedback = yvs.core.get_result_list_feedback_str(results).rstrip()
    nose.assert_equal(output, feedback)
示例#17
0
def test_copy_by_default_true():
    """should export correct data when "Copy By Default?" setting is true"""
    results = yvs.get_result_list('love others')
    nose.assert_equal(results[0]['variables']['copybydefault'], 'True')
    nose.assert_equal(results[0]['subtitle'],
                      '» “Lorem ipsum” dolor sit amet,')
    nose.assert_equal(results[0]['mods']['cmd']['subtitle'],
                      'View on YouVersion')
示例#18
0
def test_copy_by_default_false():
    """should export correct data when "Copy By Default?" setting is false"""
    results = yvs.get_result_list('love others')
    nose.assert_equal(results[0]['variables']['copybydefault'], 'False')
    nose.assert_equal(results[0]['subtitle'],
                      '» “Lorem ipsum” dolor sit amet,')
    nose.assert_equal(results[0]['mods']['cmd']['subtitle'],
                      'Copy content to clipboard')
示例#19
0
def test_structure():
    """JSON should match result list"""
    results = yvs.get_result_list('love others')
    result = results[0]
    feedback_str = yvs.core.get_result_list_feedback_str(results)
    feedback = json.loads(feedback_str)
    nose.assert_in('items', feedback, 'feedback object must have result items')
    item = feedback['items'][0]
    nose.assert_not_in('uid', item)
    nose.assert_equal(item['arg'], result['arg'])
    nose.assert_equal(item['quicklookurl'],
                      'https://www.bible.com/bible/111/ROM.13.8')
    nose.assert_equal(item['title'], 'Romans 13:8 (NIV) ♥')
    nose.assert_equal(item['text']['copy'], result['title'])
    nose.assert_equal(item['text']['largetype'], result['title'])
    nose.assert_equal(item['subtitle'], result['subtitle'])
    nose.assert_equal(item['icon']['path'], 'icon.png')
def test_cache_url_content():
    """should cache search URL content after first fetch"""
    yvs.get_result_list('love others')
    with patch('urllib2.Request') as request:
        yvs.get_result_list('love others')
        request.assert_not_called()
def test_unicode_input(get_url_content):
    """should correctly handle non-ASCII characters in query string"""
    yvs.get_result_list('é')
    get_url_content.assert_called_once_with(
        'https://www.bible.com/search/bible?q=%C3%A9&version_id=111')
def test_charref_dec_title():
    '''should evaluate character references in result titles'''
    results = yvs.get_result_list('love others')
    nose.assert_equal(len(results), 3)
    nose.assert_regexp_matches(
        results[0]['title'], 'Romans 13:8 \(NIV\) \u2665')
def test_charref_dec_subtitle():
    '''should evaluate character references in result subtitles'''
    results = yvs.get_result_list('love others')
    nose.assert_equal(len(results), 3)
    nose.assert_regexp_matches(
        results[0]['subtitle'], '\u201cLorem ipsum\u201d')
def test_charref_dec_title():
    '''should evaluate character references in result titles'''
    results = yvs.get_result_list('love others')
    nose.assert_equal(len(results), 3)
    nose.assert_regexp_matches(results[0]['title'],
                               'Romans 13:8 \(NIV\) \u2665')
示例#25
0
def test_cache_url_content():
    """should cache search URL content after first fetch"""
    yvs.get_result_list('love others')
    with patch('urllib.request.Request') as request:
        yvs.get_result_list('love others')
        request.assert_not_called()
示例#26
0
def test_unicode_input(get_url_content):
    """should correctly handle non-ASCII characters in query string"""
    yvs.get_result_list('é')
    get_url_content.assert_called_once_with(
        'https://www.bible.com/search/bible?q=%C3%A9&version_id=111')
def test_charref_dec_subtitle():
    '''should evaluate character references in result subtitles'''
    results = yvs.get_result_list('love others')
    nose.assert_equal(len(results), 3)
    nose.assert_regexp_matches(results[0]['subtitle'],
                               '\u201cLorem ipsum\u201d')