Example #1
0
 def test_tuple_wrong_msg(self):
     # Pass a pair instead of a sequence of pairs
     input = ('a', 'b')
     try:
         webracer.urlencode_utf8(input)
     except ValueError as e:
         assert 'Parameter must be a sequence of pairs' in str(e)
     else:
         self.fail('Expected ValueError to be raised')
Example #2
0
 def test_tuple_wrong_msg(self):
     # Pass a pair instead of a sequence of pairs
     input = ('a', 'b')
     try:
         webracer.urlencode_utf8(input)
     except ValueError as e:
         assert 'Parameter must be a sequence of pairs' in str(e)
     else:
         self.fail('Expected ValueError to be raised')
Example #3
0
 def check(self, input, expected):
     output = webracer.urlencode_utf8(input)
     self.assertEqual(expected, output)
Example #4
0
 def test_urlencode_simple(self):
     input = dict(a='a', b='b')
     output = webracer.urlencode_utf8(input)
     # dictionary keys are not ordered
     self.assertTrue(output == 'a=a&b=b' or output == 'b=b&a=a')
Example #5
0
 def test_urlencode_tuple_multi(self):
     input = dict(a=(1, 2))
     output = webracer.urlencode_utf8(input)
     self.assertEqual('a[]=1&a[]=2', output)
Example #6
0
 def test_urlencode_tuple(self):
     input = dict(a=(1, ))
     output = webracer.urlencode_utf8(input)
     self.assertEqual('a[]=1', output)
Example #7
0
 def test_urlencode_list_multi(self):
     input = dict(a=[1, 2])
     output = webracer.urlencode_utf8(input)
     self.assertEqual('a[]=1&a[]=2', output)
Example #8
0
 def test_urlencode_list(self):
     input = dict(a=[1])
     output = webracer.urlencode_utf8(input)
     self.assertEqual('a[]=1', output)
Example #9
0
 def check(self, input, expected):
     output = webracer.urlencode_utf8(input)
     self.assertEqual(expected, output)
Example #10
0
 def test_urlencode_simple(self):
     input = dict(a='a', b='b')
     output = webracer.urlencode_utf8(input)
     # dictionary keys are not ordered
     self.assertTrue(output == 'a=a&b=b' or output == 'b=b&a=a')
Example #11
0
 def test_urlencode_tuple_multi(self):
     input = dict(a=(1, 2))
     output = webracer.urlencode_utf8(input)
     self.assertEqual('a[]=1&a[]=2', output)
Example #12
0
 def test_urlencode_tuple(self):
     input = dict(a=(1,))
     output = webracer.urlencode_utf8(input)
     self.assertEqual('a[]=1', output)
Example #13
0
 def test_urlencode_list_multi(self):
     input = dict(a=[1, 2])
     output = webracer.urlencode_utf8(input)
     self.assertEqual('a[]=1&a[]=2', output)
Example #14
0
 def test_urlencode_list(self):
     input = dict(a=[1])
     output = webracer.urlencode_utf8(input)
     self.assertEqual('a[]=1', output)