コード例 #1
0
ファイル: api_tests.py プロジェクト: magul/pywikibot-core
 def test_moving_special_tokens(self):
     """Test moving wpEditToken to the very end."""
     query = {'wpEditToken': 'c', 'token': 'b', 'text': 'a'}
     expect = 'text=a&token=b&wpEditToken=c'
     result = api.encode_url(query)
     self.assertEqual(result, expect)
     self.assertIsInstance(result, str)
コード例 #2
0
ファイル: api_tests.py プロジェクト: MichaelEdward/pywikibot
 def test_moving_special_tokens(self):
     """Test moving wpEditToken to the very end."""
     query = {'wpEditToken': 'c', 'token': 'b', 'text': 'a'}
     expect = 'text=a&token=b&wpEditToken=c'
     result = api.encode_url(query)
     self.assertEqual(result, expect)
     self.assertIsInstance(result, str)
コード例 #3
0
ファイル: api_tests.py プロジェクト: MichaelEdward/pywikibot
 def test_url_encoding_from_unicode(self):
     """Test encoding unicode values."""
     query = {'token': 'токен'}
     expect = 'token=%D1%82%D0%BE%D0%BA%D0%B5%D0%BD'
     result = api.encode_url(query)
     self.assertEqual(result, expect)
     self.assertIsInstance(result, str)
コード例 #4
0
ファイル: api_tests.py プロジェクト: magul/pywikibot-core
 def test_url_encoding_from_unicode(self):
     """Test encoding unicode values."""
     query = {'token': 'токен'}
     expect = 'token=%D1%82%D0%BE%D0%BA%D0%B5%D0%BD'
     result = api.encode_url(query)
     self.assertEqual(result, expect)
     self.assertIsInstance(result, str)
コード例 #5
0
ファイル: api_tests.py プロジェクト: dvorapa/pywikibot
 def test_url_encoding_from_str(self):
     """Test encoding str values."""
     query = {'token': 'test\xe2\x80\x94test'}
     expect = 'token=test%C3%A2%C2%80%C2%94test'
     result = api.encode_url(query)
     self.assertEqual(result, expect)
     self.assertIsInstance(result, str)
コード例 #6
0
ファイル: api_tests.py プロジェクト: MichaelEdward/pywikibot
 def test_url_encoding_from_dict(self):
     """Test moving 'token' parameters from a dict to the end."""
     # do not add other keys because dictionary is not deterministic
     query = {'supertoken': 'b', 'text': 'text'}
     expect = 'text=text&supertoken=b'
     result = api.encode_url(query)
     self.assertEqual(result, expect)
     self.assertIsInstance(result, str)
コード例 #7
0
ファイル: api_tests.py プロジェクト: MichaelEdward/pywikibot
 def test_url_encoding_from_list(self):
     """Test moving 'token' parameters from a list to the end."""
     query = [('action', 'edit'), ('token', 'a'), ('supertoken', 'b'),
              ('text', 'text')]
     expect = 'action=edit&text=text&token=a&supertoken=b'
     result = api.encode_url(query)
     self.assertEqual(result, expect)
     self.assertIsInstance(result, str)
コード例 #8
0
ファイル: api_tests.py プロジェクト: magul/pywikibot-core
 def test_url_encoding_from_dict(self):
     """Test moving 'token' parameters from a dict to the end."""
     # do not add other keys because dictionary is not deterministic
     query = {'supertoken': 'b', 'text': 'text'}
     expect = 'text=text&supertoken=b'
     result = api.encode_url(query)
     self.assertEqual(result, expect)
     self.assertIsInstance(result, str)
コード例 #9
0
ファイル: api_tests.py プロジェクト: magul/pywikibot-core
 def test_url_encoding_from_list(self):
     """Test moving 'token' parameters from a list to the end."""
     query = [('action', 'edit'), ('token', 'a'), ('supertoken', 'b'),
              ('text', 'text')]
     expect = 'action=edit&text=text&token=a&supertoken=b'
     result = api.encode_url(query)
     self.assertEqual(result, expect)
     self.assertIsInstance(result, str)
コード例 #10
0
ファイル: api_tests.py プロジェクト: MichaelEdward/pywikibot
 def test_url_encoding_from_basestring(self):
     """Test encoding basestring values."""
     if PY2:
         query = {'token': str('test\xe2\x80\x94test'.encode('utf-8'))}
     else:
         query = {'token': 'test\xe2\x80\x94test'}
     expect = str('token=test%C3%A2%C2%80%C2%94test')
     result = api.encode_url(query)
     self.assertEqual(result, expect)
     self.assertIsInstance(result, str)
コード例 #11
0
ファイル: api_tests.py プロジェクト: magul/pywikibot-core
 def test_url_encoding_from_basestring(self):
     """Test encoding basestring values."""
     if PY2:
         query = {'token': str('test\xe2\x80\x94test'.encode('utf-8'))}
     else:
         query = {'token': 'test\xe2\x80\x94test'}
     expect = str('token=test%C3%A2%C2%80%C2%94test')
     result = api.encode_url(query)
     self.assertEqual(result, expect)
     self.assertIsInstance(result, str)