示例#1
0
def test_set_parameter_base64_encoded():
    helper = UrlHelper('my-social-network.imgix.net', '~text',
                       include_library_param=False)

    helper.set_parameter("txt64", u"I cannøt belîév∑ it wors! 😱")
    assert str(helper) == "https://my-social-network.imgix.net/~text?txt64=" \
                          "SSBjYW5uw7h0IGJlbMOuw6l24oiRIGl0IHdvcu-jv3MhIPCfmLE"
def test_set_parameter_base64_encoded():
    helper = UrlHelper('my-social-network.imgix.net', '~text',
                       sign_with_library_version=False)

    helper.set_parameter("txt64", u"I cannøt belîév∑ it wors! 😱")
    assert str(helper) == "https://my-social-network.imgix.net/~text?txt64=" \
                          "SSBjYW5uw7h0IGJlbMOuw6l24oiRIGl0IHdvcu-jv3MhIPCfmLE"
def test_set_parameter_with_false_value():
    helper = UrlHelper('my-social-network.imgix.net', '/users/1.png',
                       opts={'h': 300, 'w': 400},
                       sign_with_library_version=False)

    helper.set_parameter("w", False)
    assert str(helper) == "https://my-social-network.imgix.net" \
                          "/users/1.png?h=300"
示例#4
0
def test_set_parameter_with_false_value():
    helper = UrlHelper('my-social-network.imgix.net', '/users/1.png',
                       params={'h': 300, 'w': 400},
                       include_library_param=False)

    helper.set_parameter("w", False)
    assert str(helper) == "https://my-social-network.imgix.net" \
                          "/users/1.png?h=300&w=False"
def test_set_parameter_with_init_opts():
    helper = UrlHelper('my-social-network.imgix.net', '/users/1.png',
                       opts={"or": 0},
                       sign_with_library_version=False)

    helper.set_parameter('w', 400)
    helper.set_parameter('h', 300)
    assert str(helper) == "https://my-social-network.imgix.net" \
                          "/users/1.png?h=300&or=0&w=400"
示例#6
0
def test_set_parameter_with_init_params():
    helper = UrlHelper('my-social-network.imgix.net', '/users/1.png',
                       params={"or": 0},
                       include_library_param=False)

    helper.set_parameter('w', 400)
    helper.set_parameter('h', 300)
    assert str(helper) == "https://my-social-network.imgix.net" \
                          "/users/1.png?h=300&or=0&w=400"
def test_set_parameter():
    helper = UrlHelper('my-social-network.imgix.net', '/users/1.png',
                       sign_with_library_version=False)

    helper.set_parameter('w', 400)
    assert str(helper) == "https://my-social-network.imgix.net/" \
                          "users/1.png?w=400"

    helper.set_parameter('h', 300)
    assert str(helper) == "https://my-social-network.imgix.net/" \
                          "users/1.png?h=300&w=400"
示例#8
0
def test_set_parameter():
    helper = UrlHelper('my-social-network.imgix.net', '/users/1.png',
                       include_library_param=False)

    helper.set_parameter('w', 400)
    assert str(helper) == "https://my-social-network.imgix.net/" \
                          "users/1.png?w=400"

    helper.set_parameter('h', 300)
    assert str(helper) == "https://my-social-network.imgix.net/" \
                          "users/1.png?h=300&w=400"
示例#9
0
def test_set_parameter_with_none_value():
    helper = UrlHelper('my-social-network.imgix.net',
                       '/users/1.png',
                       params={
                           'h': 300,
                           'w': 400
                       },
                       include_library_param=False)

    helper.set_parameter("w", None)
    assert str(helper) == "https://my-social-network.imgix.net" \
                          "/users/1.png?h=300&w=None"