コード例 #1
0
ファイル: testcase.py プロジェクト: abhijo89-uc/resttest3
 def auth_password(self, password):
     self.__auth_password = Parser.coerce_string_to_ascii(password)
コード例 #2
0
 def test_coerce_string_to_ascii(self):
     self.assertEqual(b'stuff', Parser.coerce_string_to_ascii(u'stuff'))
     self.assertRaises(UnicodeEncodeError, Parser.coerce_string_to_ascii,
                       u'st😽uff')
     self.assertRaises(TypeError, Parser.coerce_string_to_ascii, 1)
     self.assertRaises(TypeError, Parser.coerce_string_to_ascii, None)
コード例 #3
0
ファイル: testcase.py プロジェクト: abhijo89-uc/resttest3
 def auth_username(self, username):
     self.__auth_username = Parser.coerce_string_to_ascii(username)
コード例 #4
0
 def test_coerce_string_to_ascii(self):
     result = Parser.coerce_string_to_ascii(bytes("Hello", 'utf-8'))
     self.assertEqual(result, "Hello".encode('ascii'))