def test_add_param_encodes_and_adds_the_given_parameter_to_the_QueryString( self): s = QueryString(u'') assert s.add_param(u'abc', u'123') == u'abc=123' assert (s.add_param(u'abc', u'123').add_param(u'def', u'456') == u'abc=123&def=456')
def test_add_params_with_multiple_values_adds_the_same_parameter_multiple_times(self): s = QueryString("") assert s.add_params({"foo": ["bar", "baz"]}) == s.add_param("foo", "bar").add_param("foo", "baz")
def test_add_param_allows_the_same_parameter_name_to_be_added_twice(self): s = QueryString(u'abc=123') assert s.add_param(u'abc', u'456') == u'abc=123&abc=456'
def test_add_param_can_add_anonymous_parameters(self): s = QueryString(u'abc=123') assert s.add_param(u'', u'456') == u'abc=123&=456'
def test_add_param_can_add_valueless_parameters(self): s = QueryString(u'abc=123') assert s.add_param(u'def', None) == u'abc=123&def'
def test_add_params_with_multiple_values_adds_the_same_parameter_multiple_times(self): s = QueryString(u'') assert (s.add_params({u'foo': [u'bar', u'baz']}) == s.add_param(u'foo', u'bar').add_param(u'foo', u'baz'))
def test_add_param_allows_the_same_parameter_name_to_be_added_twice(self): s = QueryString('abc=123') assert s.add_param('abc', '456') == 'abc=123&abc=456'
def test_add_param_encodes_utf8(self): s = QueryString('abc=123') assert s.add_param('foo', u('\ufffd')) == 'abc=123&foo=%EF%BF%BD'
def test_add_param_allows_the_same_parameter_name_to_be_added_twice(self): s = QueryString("abc=123") assert s.add_param("abc", "456") == "abc=123&abc=456"
def test_add_param_accepts_int(self): s = QueryString("") assert s.add_param("abc", 123) == "abc=123"
def test_add_param_encodes_utf8(self): s = QueryString("abc=123") assert s.add_param("foo", u("\ufffd")) == "abc=123&foo=%EF%BF%BD"
def test_add_param_can_add_anonymous_parameters(self): s = QueryString("abc=123") assert s.add_param("", "456") == "abc=123&=456"
def test_add_param_can_add_empty_valued_parameters(self): s = QueryString("abc=123") assert s.add_param("def", "") == "abc=123&def="
def test_add_param_can_add_valueless_parameters(self): s = QueryString("abc=123") assert s.add_param("def", None) == "abc=123&def"
def test_add_param_encodes_and_adds_the_given_parameter_to_the_QueryString(self): s = QueryString("") assert s.add_param("abc", "123") == "abc=123" assert s.add_param("abc", "123").add_param("def", "456") == "abc=123&def=456"
def test_add_param_can_add_empty_valued_parameters(self): s = QueryString('abc=123') assert s.add_param('def', '') == 'abc=123&def='
def test_add_param_can_add_anonymous_parameters(self): s = QueryString('abc=123') assert s.add_param('', '456') == 'abc=123&=456'
def test_add_param_encodes_special_characters(self): s = QueryString("abc=123") assert s.add_param("d e f", "4+5#6") == "abc=123&d+e+f=4%2B5%236"
def test_add_param_accepts_int(self): s = QueryString('') assert s.add_param('abc', 123) == 'abc=123'
def test_add_param_encodes_special_characters(self): s = QueryString(u'abc=123') assert s.add_param(u'd e f', u'4+5#6') == u'abc=123&d%20e%20f=4%2B5%236'
def test_add_params_is_equivalent_to_calling_add_param_multiple_times(self): s = QueryString(u'') assert (s.add_params([(u'abc', u'123'), (u'def', u'456')]) == s.add_param(u'abc', u'123').add_param(u'def', u'456'))
def test_add_param_encodes_special_characters(self): s = QueryString('abc=123') assert s.add_param('d e f', '4+5#6') == 'abc=123&d+e+f=4%2B5%236'
def test_add_param_encodes_and_adds_the_given_parameter_to_the_QueryString(self): s = QueryString(u'') assert s.add_param(u'abc', u'123') == u'abc=123' assert (s.add_param(u'abc', u'123') .add_param(u'def', u'456') == u'abc=123&def=456')
def test_add_params_is_equivalent_to_calling_add_param_multiple_times(self): s = QueryString('') assert (s.add_params([('abc', '123'), ('def', '456')]) == s.add_param('abc', '123').add_param('def', '456'))
def test_add_param_can_add_empty_valued_parameters(self): s = QueryString(u'abc=123') assert s.add_param(u'def', u'') == u'abc=123&def='
def test_add_params_with_multiple_values_adds_the_same_parameter_multiple_times(self): s = QueryString('') assert (s.add_params({'foo': ['bar', 'baz']}) == s.add_param('foo', 'bar').add_param('foo', 'baz'))
def test_add_param_encodes_utf8(self): s = QueryString(u'abc=123') assert s.add_param(u'foo', u'\ufffd') == u'abc=123&foo=%EF%BF%BD'
def test_add_param_can_add_valueless_parameters(self): s = QueryString('abc=123') assert s.add_param('def', None) == 'abc=123&def'
def test_add_params_is_equivalent_to_calling_add_param_multiple_times(self): s = QueryString("") assert s.add_params([("abc", "123"), ("def", "456")]) == s.add_param("abc", "123").add_param("def", "456")