コード例 #1
0
ファイル: test_rfc6570.py プロジェクト: ustwo/mastermind
def test_form_style_query():
    assert rfc.expand_segments("{?x,y}", [x, y]) == "{?x,y}"
    assert rfc.expand_pairs("{?x,y}", [("x", x), ("y", y)]) == "?x=1024&y=768"
    assert rfc.expand_pairs("{?x,y,empty}",
                            [("x", x),
                             ("y", y),
                             ("empty", empty)]) == "?x=1024&y=768&empty="
コード例 #2
0
ファイル: test_rfc6570.py プロジェクト: umorena/mastermind-1
def test_form_style_query_continuation():
    assert rfc.expand_segments("{&x,y}", [x, y]) == "{&x,y}"
    assert rfc.expand_pairs("?fixed=yes{&x}",
                            [("x", x)]) == "?fixed=yes&x=1024"
    assert rfc.expand_pairs("{&x,y,empty}",
                            [("x", x), ("y", y),
                             ("empty", empty)]) == "&x=1024&y=768&empty="
コード例 #3
0
ファイル: test_rfc6570.py プロジェクト: ustwo/mastermind
def test_path_style_parameters():
    assert rfc.expand_segments("{;x,y}", [x, y]) == "{;x,y}"
    assert rfc.expand_pairs("{;x,y}", [("x", x), ("y", y)]) == ";x=1024;y=768"
    assert rfc.expand_pairs("{;x,y,empty}",
                            [("x", x),
                             ("y", y),
                             ("empty", empty)]) == ";x=1024;y=768;empty"
コード例 #4
0
ファイル: test_rfc6570.py プロジェクト: ustwo/mastermind
def test_form_style_query_continuation():
    assert rfc.expand_segments("{&x,y}", [x, y]) == "{&x,y}"
    assert rfc.expand_pairs("?fixed=yes{&x}",
                            [("x", x)]) == "?fixed=yes&x=1024"
    assert rfc.expand_pairs("{&x,y,empty}",
                            [("x", x),
                             ("y", y),
                             ("empty", empty)]) == "&x=1024&y=768&empty="
コード例 #5
0
ファイル: test_rfc6570.py プロジェクト: CandiceW/mastermind
def test_partial_segments():
    assert rfc.expand_segments("{var}", []) == ""
    assert rfc.expand_segments("{var}", [], partial=True) == "{var}"
    assert rfc.expand_segments("{+path}/{var}", [path], partial=True) == "/foo/bar/{var}"
    assert rfc.expand_segments("{x,y}", [x], partial=True) == "1024{y}"
    assert rfc.expand_segments("{/var,x}", [var], partial=True) == "/value{/x}"
    assert rfc.expand_segments("{/var,x,empty}", [var], partial=True) == "/value{/x,empty}"
コード例 #6
0
ファイル: test_rfc6570.py プロジェクト: umorena/mastermind-1
def test_partial_segments():
    assert rfc.expand_segments("{var}", []) == ""
    assert rfc.expand_segments("{var}", [], partial=True) == "{var}"
    assert rfc.expand_segments("{+path}/{var}", [path],
                               partial=True) == "/foo/bar/{var}"
    assert rfc.expand_segments("{x,y}", [x], partial=True) == "1024{y}"
    assert rfc.expand_segments("{/var,x}", [var], partial=True) == "/value{/x}"
    assert rfc.expand_segments("{/var,x,empty}", [var],
                               partial=True) == "/value{/x,empty}"
コード例 #7
0
ファイル: test_rfc6570.py プロジェクト: CandiceW/mastermind
def test_label_expansion():
    assert rfc.expand_segments("X{.var}", [var]) == "X.value"
    assert rfc.expand_segments("X{.x,y}", [x, y]) == "X.1024,768"
コード例 #8
0
ファイル: test_rfc6570.py プロジェクト: CandiceW/mastermind
def test_reserved_expansion_with_multiple_variables():
    assert rfc.expand_segments("{+x,hello,y}", [x, hello, y]) == "1024,Hello%20World!,768"
    assert rfc.expand_segments("{+path,x}/here", [path, x]) == "/foo/bar,1024/here"
コード例 #9
0
ファイル: test_rfc6570.py プロジェクト: CandiceW/mastermind
def test_fragment_expansion():
    assert rfc.expand_segments("X{#var}", [var]) == "X#value"
    assert rfc.expand_segments("X{#hello}", [hello]) == "X#Hello%20World!"
コード例 #10
0
ファイル: test_rfc6570.py プロジェクト: umorena/mastermind-1
def test_reserved_expansion_with_multiple_variables():
    assert rfc.expand_segments("{+x,hello,y}",
                               [x, hello, y]) == "1024,Hello%20World!,768"
    assert rfc.expand_segments("{+path,x}/here",
                               [path, x]) == "/foo/bar,1024/here"
コード例 #11
0
ファイル: test_rfc6570.py プロジェクト: umorena/mastermind-1
def test_string_expansion_with_multiple_variables():
    assert rfc.expand_segments("map?{x,y}", [x, y]) == "map?1024,768"
    assert rfc.expand_segments("{x,hello,y}",
                               [x, hello, y]) == "1024,Hello%20World%21,768"
コード例 #12
0
ファイル: test_rfc6570.py プロジェクト: umorena/mastermind-1
def test_fragment_expansion():
    assert rfc.expand_segments("X{#var}", [var]) == "X#value"
    assert rfc.expand_segments("X{#hello}", [hello]) == "X#Hello%20World!"
コード例 #13
0
ファイル: test_rfc6570.py プロジェクト: umorena/mastermind-1
def test_reserved_string_expansion():
    assert rfc.expand_segments("{+var}", [var]) == "value"
    assert rfc.expand_segments("{+hello}", [hello]) == "Hello%20World!"
    assert rfc.expand_segments("{+path}/here", [path]) == "/foo/bar/here"
    assert rfc.expand_segments("here?ref={+path}",
                               [path]) == "here?ref=/foo/bar"
コード例 #14
0
ファイル: test_rfc6570.py プロジェクト: umorena/mastermind-1
def test_combined():
    subject = rfc.expand_segments("http://example.com/{var}{+path}{?x,y}",
                                  [var, path])
    expected = "http://example.com/value/foo/bar?x=1024&y=768"

    assert rfc.expand_pairs(subject, [("x", x), ("y", y)]) == expected
コード例 #15
0
ファイル: test_rfc6570.py プロジェクト: umorena/mastermind-1
def test_simple_string_expansion():
    assert rfc.expand_segments("{var}", [var]) == "value"
    assert rfc.expand_segments("{hello}", [hello]) == "Hello%20World%21"
コード例 #16
0
ファイル: test_rfc6570.py プロジェクト: CandiceW/mastermind
def test_simple_string_expansion():
    assert rfc.expand_segments("{var}", [var]) == "value"
    assert rfc.expand_segments("{hello}", [hello]) == "Hello%20World%21"
コード例 #17
0
ファイル: test_rfc6570.py プロジェクト: CandiceW/mastermind
def test_reserved_string_expansion():
    assert rfc.expand_segments("{+var}", [var]) == "value"
    assert rfc.expand_segments("{+hello}", [hello]) == "Hello%20World!"
    assert rfc.expand_segments("{+path}/here", [path]) == "/foo/bar/here"
    assert rfc.expand_segments("here?ref={+path}", [path]) == "here?ref=/foo/bar"
コード例 #18
0
ファイル: test_rfc6570.py プロジェクト: umorena/mastermind-1
def test_fragment_expansion_with_multiple_variables():
    assert rfc.expand_segments("{#x,hello,y}",
                               [x, hello, y]) == "#1024,Hello%20World!,768"
    assert rfc.expand_segments("{#path,x}/here",
                               [path, x]) == "#/foo/bar,1024/here"
コード例 #19
0
ファイル: test_rfc6570.py プロジェクト: CandiceW/mastermind
def test_string_expansion_with_multiple_variables():
    assert rfc.expand_segments("map?{x,y}", [x, y]) == "map?1024,768"
    assert rfc.expand_segments("{x,hello,y}", [x, hello, y]) == "1024,Hello%20World%21,768"
コード例 #20
0
ファイル: test_rfc6570.py プロジェクト: umorena/mastermind-1
def test_label_expansion():
    assert rfc.expand_segments("X{.var}", [var]) == "X.value"
    assert rfc.expand_segments("X{.x,y}", [x, y]) == "X.1024,768"
コード例 #21
0
ファイル: test_rfc6570.py プロジェクト: CandiceW/mastermind
def test_fragment_expansion_with_multiple_variables():
    assert rfc.expand_segments("{#x,hello,y}", [x, hello, y]) == "#1024,Hello%20World!,768"
    assert rfc.expand_segments("{#path,x}/here", [path, x]) == "#/foo/bar,1024/here"
コード例 #22
0
ファイル: test_rfc6570.py プロジェクト: umorena/mastermind-1
def test_path_segments():
    assert rfc.expand_segments("{/var}", [var]) == "/value"
    assert rfc.expand_segments("{/var,x}/here", [var, x]) == "/value/1024/here"
コード例 #23
0
ファイル: test_rfc6570.py プロジェクト: CandiceW/mastermind
def test_path_segments():
    assert rfc.expand_segments("{/var}", [var]) == "/value"
    assert rfc.expand_segments("{/var,x}/here", [var, x]) == "/value/1024/here"
コード例 #24
0
ファイル: test_rfc6570.py プロジェクト: umorena/mastermind-1
def test_path_style_parameters():
    assert rfc.expand_segments("{;x,y}", [x, y]) == "{;x,y}"
    assert rfc.expand_pairs("{;x,y}", [("x", x), ("y", y)]) == ";x=1024;y=768"
    assert rfc.expand_pairs("{;x,y,empty}",
                            [("x", x), ("y", y),
                             ("empty", empty)]) == ";x=1024;y=768;empty"
コード例 #25
0
ファイル: test_rfc6570.py プロジェクト: CandiceW/mastermind
def test_combined():
    assert rfc.expand_pairs(rfc.expand_segments("http://example.com/{var}{+path}{?x,y}", [var, path]),
                            [("x", x), ("y", y)]) == "http://example.com/value/foo/bar?x=1024&y=768"
コード例 #26
0
ファイル: test_rfc6570.py プロジェクト: umorena/mastermind-1
def test_form_style_query():
    assert rfc.expand_segments("{?x,y}", [x, y]) == "{?x,y}"
    assert rfc.expand_pairs("{?x,y}", [("x", x), ("y", y)]) == "?x=1024&y=768"
    assert rfc.expand_pairs("{?x,y,empty}",
                            [("x", x), ("y", y),
                             ("empty", empty)]) == "?x=1024&y=768&empty="