def test_unicode(self): test_pwd = ulit('H\u00c3l\u00c5o!:)') tm = self.PasswordModel.create(username='******', password=test_pwd) tm_db = self.PasswordModel.get(self.PasswordModel.id == tm.id) self.assertTrue(tm_db.password.check_password(test_pwd),'Correct unicode password did not match')
def test_unicode(self): # create a unicode literal ustr = ulit('Lýðveldið Ísland') u = User.create(username=ustr) # query using the unicode literal u_db = User.get(User.username == ustr) # the db returns a unicode literal self.assertEqual(u_db.username, ustr) # delete the user self.assertEqual(u.delete_instance(), 1) # convert the unicode to a utf8 string utf8_str = ustr.encode('utf-8') # create using the utf8 string u2 = User.create(username=utf8_str) # query using unicode literal u2_db = User.get(User.username == ustr) # we get unicode back self.assertEqual(u2_db.username, ustr)
def test_unicode(self): test_pwd = ulit('H\u00c3l\u00c5o!:)') tm = self.PasswordModel.create(username='******', password=test_pwd) tm_db = self.PasswordModel.get(self.PasswordModel.id == tm.id) self.assertTrue(tm_db.password.check_password(test_pwd), 'Correct unicode password did not match')
def setUp(self): super(TestUnicodeConversion, self).setUp() # Create a user object with UTF-8 encoded username. ustr = ulit('Ísland') self.user = User.create(username=ustr)
def test_unicode_issue202(self): ustr = ulit('M\u00f6rk') user = User.create(username=ustr) self.assertEqual(user.username, ustr)