Beispiel #1
0
def test_change_param():
    param = "http://coderecode.com/?p=test"
    expected = "http://coderecode.com/?p=changed"

    assert change_param(param, "p", "changed") == expected
Beispiel #2
0
def test_change_param_create_new():
    param = "http://coderecode.com/"
    expected = "http://coderecode.com/?p=changed"

    assert change_param(param, "p", "changed", create_new=True) == expected
Beispiel #3
0
def test_change_param_error():
    param = None
    with pytest.raises(ValueError):
        change_param(param, "p", "changed")
Beispiel #4
0
def test_change_param_upgrade_https():
    param = "http://coderecode.com/?p=test"
    expected = "https://coderecode.com/?p=changed"

    assert change_param(param, "p", "changed", upgrade_https=True) == expected
Beispiel #5
0
def test_change_param_no_param():
    param = "http://coderecode.com"
    expected = "http://coderecode.com"

    assert change_param(url=param, param="test",
                        new_value="new_value") == expected