# HG changeset patch # User Mads Kiilerich # Date 2015-01-06 00:54:36 # Node ID c154dc461bd5ff00a07d9da9fcf848ae6b111eb4 # Parent 52bf718b30f595a536bb7c7836c78c20923d1e75 tests: fix some test sqlalchemy unicode warnings diff --git a/kallithea/model/db.py b/kallithea/model/db.py --- a/kallithea/model/db.py +++ b/kallithea/model/db.py @@ -2275,7 +2275,7 @@ class PullRequest(Base, BaseModel): @revisions.setter def revisions(self, val): - self._revisions = ':'.join(val) + self._revisions = safe_unicode(':'.join(val)) @property def org_ref_parts(self): diff --git a/kallithea/model/forms.py b/kallithea/model/forms.py --- a/kallithea/model/forms.py +++ b/kallithea/model/forms.py @@ -514,11 +514,11 @@ def GistForm(lifetime_options): filename = All(v.BasePath()(), v.UnicodeString(strip=True, required=False)) - description = v.UnicodeString(required=False, if_missing='') + description = v.UnicodeString(required=False, if_missing=u'') lifetime = v.OneOf(lifetime_options) mimetype = v.UnicodeString(required=False, if_missing=None) content = v.UnicodeString(required=True, not_empty=True) - public = v.UnicodeString(required=False, if_missing='') - private = v.UnicodeString(required=False, if_missing='') + public = v.UnicodeString(required=False, if_missing=u'') + private = v.UnicodeString(required=False, if_missing=u'') return _GistForm diff --git a/kallithea/tests/fixture.py b/kallithea/tests/fixture.py --- a/kallithea/tests/fixture.py +++ b/kallithea/tests/fixture.py @@ -228,7 +228,7 @@ class Fixture(object): def create_gist(self, **kwargs): form_data = { - 'description': 'new-gist', + 'description': u'new-gist', 'owner': TEST_USER_ADMIN_LOGIN, 'gist_type': GistModel.cls.GIST_PUBLIC, 'lifetime': -1, diff --git a/kallithea/tests/functional/test_admin_gists.py b/kallithea/tests/functional/test_admin_gists.py --- a/kallithea/tests/functional/test_admin_gists.py +++ b/kallithea/tests/functional/test_admin_gists.py @@ -5,7 +5,7 @@ from kallithea.model.db import User, Gis def _create_gist(f_name, content='some gist', lifetime=-1, - description='gist-desc', gist_type='public', + description=u'gist-desc', gist_type='public', owner=TEST_USER_ADMIN_LOGIN): gist_mapping = { f_name: {'content': content} @@ -33,7 +33,7 @@ class TestGistsController(TestController g1 = _create_gist('gist1').gist_access_id g2 = _create_gist('gist2', lifetime=1400).gist_access_id - g3 = _create_gist('gist3', description='gist3-desc').gist_access_id + g3 = _create_gist('gist3', description=u'gist3-desc').gist_access_id g4 = _create_gist('gist4', gist_type='private').gist_access_id response = self.app.get(url('gists')) # Test response... diff --git a/kallithea/tests/functional/test_login.py b/kallithea/tests/functional/test_login.py --- a/kallithea/tests/functional/test_login.py +++ b/kallithea/tests/functional/test_login.py @@ -347,7 +347,7 @@ class TestLoginController(TestController self.assertEqual(['ChangesetController:changeset_raw'], whitelist['api_access_controllers_whitelist']) - new_api_key = ApiKeyModel().create(TEST_USER_ADMIN_LOGIN, 'test') + new_api_key = ApiKeyModel().create(TEST_USER_ADMIN_LOGIN, u'test') Session().commit() with fixture.anon_access(False): self.app.get(url(controller='changeset', @@ -361,7 +361,7 @@ class TestLoginController(TestController self.assertEqual(['ChangesetController:changeset_raw'], whitelist['api_access_controllers_whitelist']) - new_api_key = ApiKeyModel().create(TEST_USER_ADMIN_LOGIN, 'test') + new_api_key = ApiKeyModel().create(TEST_USER_ADMIN_LOGIN, u'test') Session().commit() #patch the api key and make it expired new_api_key.expires = 0