Example #1
0
def test_file_matches_other_extension():
    mk( ('%value.json', '{"Greetings,": "program!"}')
      , ('%value.txt', "Greetings, program!")
       )
    expected = "%value.txt"
    actual = os.path.basename(check_virtual_paths('/baz.txt').fs)
    assert actual == expected, actual

def test_virtual_file_with_no_extension_works():
    mk(('%value', '{"Greetings,": "program!"}'))
    check_virtual_paths('/baz.txt')
    assert NoException 

def test_normal_file_with_no_extension_works():
    mk( ('%value', '{"Greetings,": "program!"}')
      , ('value', '{"Greetings,": "program!"}')
       )
    check_virtual_paths('/baz.txt')
    assert NoException 

def test_file_with_no_extension_matches():
    mk( ('%value', '{"Greetings,": "program!"}')
      , ('value', '{"Greetings,": "program!"}')
       )
    expected = {'value': [u'baz']}
    actual = check_virtual_paths('/baz').line.uri.path
    assert actual == expected, actual


attach_teardown(globals())
Example #2
0
    m.add('foo', 8)
    m.add('fOO', 9)
    m.add('FOO', 12)
    m['bar'] = 2
    m.add('BAR', 200)
    expected = [12, 200]
    actual = m.ones('Foo', 'Bar')
    assert actual == expected, actual


def est_headers_are_case_insensitive():
    headers = BaseHeaders('Foo: bar')
    expected = 'bar'
    actual = headers.one('foo')
    assert actual == expected, actual

def est_querystring_basically_works():
    querystring = Querystring('Foo=bar')
    expected = 'bar'
    actual = querystring.one('Foo', default='missing')
    assert actual == expected, actual

def est_querystring_is_case_sensitive():
    querystring = Querystring('Foo=bar')
    expected = 'missing'
    actual = querystring.one('foo', default='missing')
    assert actual == expected, actual


attach_teardown(globals())