Пример #1
0
 def test_make_qs_from_ordered_dict(self):
     qs = make_qs(OrderedDict([('z', 'я'), ('г', 'd'), ('b', ['2', '1'])]))
     self.assertIsInstance(qs, str)
     self.assertEqual(qs, 'z=%D1%8F&%D0%B3=d&b=2&b=1')
Пример #2
0
 def test_make_qs_unicode_params(self):
     self.assertQueriesEqual(
         make_qs({'при': 'вет', 'по': 'ка'}),
         '%D0%BF%D1%80%D0%B8=%D0%B2%D0%B5%D1%82&%D0%BF%D0%BE=%D0%BA%D0%B0'
     )
Пример #3
0
 def test_make_qs_none(self):
     query_args = {'a': None, 'b': None}
     self.assertQueriesEqual(make_qs(query_args), '')
Пример #4
0
 def test_make_qs_encode(self):
     query_args = {'a': 'тест', 'b': 'тест'}
     qs = make_qs(query_args)
     self.assertIsInstance(qs, str)
     self.assertQueriesEqual(qs, 'a=%D1%82%D0%B5%D1%81%D1%82&b=%D1%82%D0%B5%D1%81%D1%82')
Пример #5
0
 def test_make_qs_not_str(self):
     query_args = {'a': 1, 'b': 2.0, 'c': True, 'd': None}
     self.assertQueriesEqual(make_qs(query_args), 'a=1&b=2.0&c=True')
Пример #6
0
 def test_make_qs_iterables(self):
     query_args = {'a': [1, 2], 'b': {1, 2}, 'c': (1, 2), 'd': frozenset((1, 2))}
     self.assertQueriesEqual(make_qs(query_args), 'a=1&a=2&b=1&b=2&c=1&c=2&d=1&d=2')
Пример #7
0
 def test_make_qs_encode(self):
     query_args = {'a': u'тест', 'b': 'тест'}
     self.assertQueriesEqual(
         make_qs(query_args),
         'a=%D1%82%D0%B5%D1%81%D1%82&b=%D1%82%D0%B5%D1%81%D1%82')
Пример #8
0
 def test_make_qs_simple(self):
     query_args = {'a': '1', 'b': '2'}
     self.assertQueriesEqual(make_qs(query_args), 'a=1&b=2')
Пример #9
0
 def test_make_qs_none(self):
     query_args = {'a': None, 'b': None}
     self.assertQueriesEqual(make_qs(query_args), '')
Пример #10
0
 def test_make_qs_not_str(self):
     query_args = {'a': 1, 'b': 2.0, 'c': True}
     self.assertQueriesEqual(make_qs(query_args), 'a=1&b=2.0&c=True')
Пример #11
0
 def test_make_qs_from_ordered_dict(self):
     qs = make_qs(OrderedDict([('z', 'я'), ('г', 'd'), ('b', ['2', '1'])]))
     self.assertIsInstance(qs, str)
     self.assertEqual(qs, 'z=%D1%8F&%D0%B3=d&b=2&b=1')
Пример #12
0
 def test_make_qs_encode(self):
     query_args = {'a': u'тест', 'b': 'тест'}
     qs = make_qs(query_args)
     self.assertIsInstance(qs, str)
     self.assertQueriesEqual(
         qs, 'a=%D1%82%D0%B5%D1%81%D1%82&b=%D1%82%D0%B5%D1%81%D1%82')
Пример #13
0
 def test_make_qs_simple(self):
     query_args = {'a': '1', 'b': '2'}
     self.assertQueriesEqual(make_qs(query_args), 'a=1&b=2')