diff --git a/attract/__init__.py b/attract/__init__.py index 08f0d0d..b9a7cce 100644 --- a/attract/__init__.py +++ b/attract/__init__.py @@ -15,7 +15,7 @@ import attract.shots_and_assets EXTENSION_NAME = 'attract' # Roles required to view task or shot details. -ROLES_REQUIRED_TO_VIEW_ITEMS = {u'demo', u'subscriber', u'admin'} +ROLES_REQUIRED_TO_VIEW_ITEMS = {'demo', 'subscriber', 'admin'} class AttractExtension(PillarExtension): diff --git a/attract/cli.py b/attract/cli.py index 58e9cdc..6d08500 100644 --- a/attract/cli.py +++ b/attract/cli.py @@ -46,7 +46,7 @@ def create_svner_account(email, project_url): log.error('Unable to find project url=%s', project_url) return 1 - account, token = create_service_account(email, [u'svner'], {'svner': {'project': proj['_id']}}) + account, token = create_service_account(email, ['svner'], {'svner': {'project': proj['_id']}}) return account, token manager.add_command("attract", manager_attract) diff --git a/attract/node_url_finders.py b/attract/node_url_finders.py index 456dd23..be8d6ca 100644 --- a/attract/node_url_finders.py +++ b/attract/node_url_finders.py @@ -16,7 +16,7 @@ def find_for_shot(project, node): @register_node_finder(node_type_task['name']) def find_for_task(project, node): - parent = node.get(u'parent') if isinstance(node, dict) else node.parent + parent = node.get('parent') if isinstance(node, dict) else node.parent if parent: endpoint = 'attract.shots.perproject.with_task' else: diff --git a/attract/setup.py b/attract/setup.py index 3966719..f8bae7a 100644 --- a/attract/setup.py +++ b/attract/setup.py @@ -4,8 +4,6 @@ This is intended to be used by the CLI and unittests only, not tested for live/production situations. """ -from __future__ import print_function, division - import copy import logging diff --git a/attract/shots_and_assets/__init__.py b/attract/shots_and_assets/__init__.py index 48c4ba2..1963ee5 100644 --- a/attract/shots_and_assets/__init__.py +++ b/attract/shots_and_assets/__init__.py @@ -21,25 +21,25 @@ from attract.node_types import node_type_shot, node_type_task, node_type_asset # From patch operation name to fields that operation may edit. VALID_SHOT_PATCH_FIELDS = { - u'from-blender': { - u'name', - u'picture', - u'properties.trim_start_in_frames', - u'properties.trim_end_in_frames', - u'properties.duration_in_edit_in_frames', - u'properties.cut_in_timeline_in_frames', - u'properties.status', - u'properties.used_in_edit', + 'from-blender': { + 'name', + 'picture', + 'properties.trim_start_in_frames', + 'properties.trim_end_in_frames', + 'properties.duration_in_edit_in_frames', + 'properties.cut_in_timeline_in_frames', + 'properties.status', + 'properties.used_in_edit', }, - u'from-web': { - u'properties.status', - u'properties.notes', - u'description', + 'from-web': { + 'properties.status', + 'properties.notes', + 'description', }, } VALID_SHOT_PATCH_OPERATIONS = { - u'from-blender', u'from-web', u'unlink', u'relink', + 'from-blender', 'from-web', 'unlink', 'relink', } log = logging.getLogger(__name__) @@ -282,15 +282,15 @@ def patch_shot(node_id, patch): node_setattr(node, key, value) else: # Remaining operations are for marking as 'in use' or 'not in use'. - if node.get('_deleted', False) and op == u'unlink': + if node.get('_deleted', False) and op == 'unlink': # We won't undelete a node in response to an unlink request. return pillar.api.utils.jsonify({'_deleted': True, '_etag': node['_etag'], '_id': node['_id']}) used_in_edit = { - u'unlink': False, - u'relink': True, + 'unlink': False, + 'relink': True, }[op] node['properties']['used_in_edit'] = used_in_edit @@ -308,8 +308,8 @@ def assert_is_valid_patch(patch): raise wz_exceptions.BadRequest("PATCH should have a key 'op' indicating the operation.") if op not in VALID_SHOT_PATCH_OPERATIONS: - valid_ops = u', '.join(sorted(VALID_SHOT_PATCH_OPERATIONS)) - raise wz_exceptions.BadRequest(u'Operation should be one of %s' % valid_ops) + valid_ops = ', '.join(sorted(VALID_SHOT_PATCH_OPERATIONS)) + raise wz_exceptions.BadRequest('Operation should be one of %s' % valid_ops) if op not in VALID_SHOT_PATCH_FIELDS: # Valid operation, and we don't have to check the fields. @@ -324,7 +324,7 @@ def assert_is_valid_patch(patch): disallowed_fields = fields - allowed_fields if disallowed_fields: - raise wz_exceptions.BadRequest(u"Operation '%s' does not allow you to set fields %s" % ( + raise wz_exceptions.BadRequest("Operation '%s' does not allow you to set fields %s" % ( op, disallowed_fields )) diff --git a/attract/shots_and_assets/eve_hooks.py b/attract/shots_and_assets/eve_hooks.py index 1597505..113f918 100644 --- a/attract/shots_and_assets/eve_hooks.py +++ b/attract/shots_and_assets/eve_hooks.py @@ -72,8 +72,8 @@ def activity_after_replacing_shot_asset(shot_or_asset, original): descr = 'changed the thumbnail of %s "%s"' % (typename, shot_or_asset['name']) elif key == 'properties.status': val_shot = pillar.web.jinja.format_undertitle(val_shot) - elif isinstance(val_shot, basestring) and len(val_shot) > 80: - val_shot = val_shot[:80] + u'…' + elif isinstance(val_shot, str) and len(val_shot) > 80: + val_shot = val_shot[:80] + '…' if descr is None: # A name change activity contains both the old and the new name. diff --git a/attract/subversion/__init__.py b/attract/subversion/__init__.py index dfd607e..cd77faa 100644 --- a/attract/subversion/__init__.py +++ b/attract/subversion/__init__.py @@ -1,7 +1,5 @@ """Subversion interface.""" -from __future__ import absolute_import - import collections import dateutil.parser import re diff --git a/attract/subversion/routes.py b/attract/subversion/routes.py index 5c4c2e6..2529f92 100644 --- a/attract/subversion/routes.py +++ b/attract/subversion/routes.py @@ -36,7 +36,7 @@ def subversion_kick(project, attract_props): @api_blueprint.route('//subversion/log', methods=['POST']) -@authorization.require_login(require_roles={u'service', u'svner'}, require_all=True) +@authorization.require_login(require_roles={'service', 'svner'}, require_all=True) def subversion_log(project_url): if request.mimetype != 'application/json': log.warning('Received %s instead of application/json', request.mimetype) diff --git a/attract/tasks/__init__.py b/attract/tasks/__init__.py index d7013c6..d453484 100644 --- a/attract/tasks/__init__.py +++ b/attract/tasks/__init__.py @@ -66,7 +66,7 @@ class TaskManager(object): task.description = fields.pop('description') task.properties.status = fields.pop('status') task.properties.task_type = fields.pop('task_type', None) - if isinstance(task.properties.task_type, basestring): + if isinstance(task.properties.task_type, str): task.properties.task_type = task.properties.task_type.strip() or None due_date = fields.pop('due_date', None) @@ -150,13 +150,13 @@ class TaskManager(object): :type log_entry: attract.subversion.LogEntry """ - self._log.info(u"Task '%s' logged in SVN by %s: %s...", + self._log.info("Task '%s' logged in SVN by %s: %s...", shortcode, log_entry.author, log_entry.msg[:30].replace('\n', ' // ')) # Find the task task = self.api_task_for_shortcode(shortcode) if not task: - self._log.warning(u'Task %s not found, ignoring SVN commit.', shortcode) + self._log.warning('Task %s not found, ignoring SVN commit.', shortcode) return # Find the author @@ -164,7 +164,7 @@ class TaskManager(object): proj = db['projects'].find_one({'_id': task['project']}, projection={'extension_props.attract': 1}) if not proj: - self._log.warning(u'Project %s for task %s not found, ignoring SVN commit.', + self._log.warning('Project %s for task %s not found, ignoring SVN commit.', task['project'], task['_id']) return @@ -175,7 +175,7 @@ class TaskManager(object): if user_id: msg = 'committed SVN revision %s: %s' % (log_entry.revision, log_entry.msg) else: - self._log.warning(u'No Pillar user mapped for SVN user %s, using SVNer account.', + self._log.warning('No Pillar user mapped for SVN user %s, using SVNer account.', log_entry.author) user_id = authentication.current_user_id() msg = 'committed SVN revision %s authored by SVN user %s: %s' % ( diff --git a/attract/tasks/eve_hooks.py b/attract/tasks/eve_hooks.py index 3a81108..f2510d0 100644 --- a/attract/tasks/eve_hooks.py +++ b/attract/tasks/eve_hooks.py @@ -112,7 +112,7 @@ def register_task_activity(task, descr): def get_user_list(user_list): if not user_list: - return u'-nobody-' + return '-nobody-' user_coll = current_app.db()['users'] users = user_coll.find( @@ -123,7 +123,7 @@ def get_user_list(user_list): ) names = [user['full_name'] for user in users] - return u', '.join(names) + return ', '.join(names) @only_for_task @@ -150,8 +150,8 @@ def activity_after_replacing_task(task, original): human_key = 'assigned users' val_task = get_user_list(val_task) descr = 'assigned task "%s" to %s' % (task['name'], val_task) - elif isinstance(val_task, basestring) and len(val_task) > 80: - val_task = val_task[:80] + u'…' + elif isinstance(val_task, str) and len(val_task) > 80: + val_task = val_task[:80] + '…' if descr is None: # A name change activity contains both the old and the new name. @@ -181,13 +181,13 @@ def activity_after_deleting_task(task): def set_defaults(task): from attract import shortcodes - shortcode = shortcodes.generate_shortcode(task['project'], task['node_type'], u'T') + shortcode = shortcodes.generate_shortcode(task['project'], task['node_type'], 'T') task_properties = task.setdefault('properties', {}) task_properties['shortcode'] = shortcode # When the task is assigned to a user, this prevents a change of 'assigned_to' to a dict. # Instead, the activity will be registered on 'assigned_to.users', which is nicer. - task_properties.setdefault('assigned_to', {u'users': []}) + task_properties.setdefault('assigned_to', {'users': []}) def nodes_set_defaults(nodes): diff --git a/tests/test_shortcode.py b/tests/test_shortcode.py index 244f128..ca3d754 100644 --- a/tests/test_shortcode.py +++ b/tests/test_shortcode.py @@ -1,8 +1,5 @@ # -*- coding=utf-8 -*- - -from __future__ import absolute_import - import collections import datetime import logging.config @@ -33,9 +30,9 @@ class ShortcodeTest(AbstractAttractTest): from attract import shortcodes with self.app.test_request_context(): - code = shortcodes.generate_shortcode(self.proj_id, u'jemoeder', u'ø') - self.assertEqual(u'ø1', code) + code = shortcodes.generate_shortcode(self.proj_id, 'jemoeder', 'ø') + self.assertEqual('ø1', code) with self.app.test_request_context(): - code = shortcodes.generate_shortcode(self.proj_id, u'jemoeder', u'č') - self.assertEqual(u'č2', code) + code = shortcodes.generate_shortcode(self.proj_id, 'jemoeder', 'č') + self.assertEqual('č2', code) diff --git a/tests/test_shots.py b/tests/test_shots.py index 0ded57e..d241cd3 100644 --- a/tests/test_shots.py +++ b/tests/test_shots.py @@ -57,13 +57,13 @@ class ShotManagerTest(AbstractShotTest): shot1_id = shot1['_id'] shot2_id = shot2['_id'] - task1 = self.create_task(shot1_id, u'fx') - task2 = self.create_task(shot1_id, u'fx') - task3 = self.create_task(shot1_id, u'høken') + task1 = self.create_task(shot1_id, 'fx') + task2 = self.create_task(shot1_id, 'fx') + task3 = self.create_task(shot1_id, 'høken') - task4 = self.create_task(shot2_id, u'effects') - task5 = self.create_task(shot2_id, u'effects') - task6 = self.create_task(shot2_id, u'ïnžane') + task4 = self.create_task(shot2_id, 'effects') + task5 = self.create_task(shot2_id, 'effects') + task6 = self.create_task(shot2_id, 'ïnžane') with self.app.test_request_context(): # Log in as project admin user @@ -71,7 +71,7 @@ class ShotManagerTest(AbstractShotTest): self.mock_blenderid_validate_happy() shot_id_to_task = self.smngr.tasks_for_nodes([shot1, shot2], - [u'fx', u'høken', u'effects']) + ['fx', 'høken', 'effects']) # Just test based on task IDs, as strings are turned into datetimes etc. by the API, # so we can't test equality. @@ -80,12 +80,12 @@ class ShotManagerTest(AbstractShotTest): all_tasks[task_type] = {task['_id'] for task in tasks} self.assertEqual({ - u'fx': {task1['_id'], task2['_id']}, - u'høken': {task3['_id']}, + 'fx': {task1['_id'], task2['_id']}, + 'høken': {task3['_id']}, }, shot_id_to_task[shot1_id]) self.assertEqual({ - u'effects': {task4['_id'], task5['_id']}, + 'effects': {task4['_id'], task5['_id']}, None: {task6['_id']}, }, shot_id_to_task[shot2_id]) @@ -110,8 +110,8 @@ class ShotManagerTest(AbstractShotTest): # _etag='jemoeder') self.smngr.edit_shot(shot_id=shot['_id'], - name=u'ผัดไทย', - description=u'Shoot the Pad Thai', + name='ผัดไทย', + description='Shoot the Pad Thai', status='todo', notes=None, _etag=shot._etag) @@ -121,9 +121,9 @@ class ShotManagerTest(AbstractShotTest): nodes_coll = self.app.data.driver.db['nodes'] found = nodes_coll.find_one(ObjectId(shot['_id'])) self.assertEqual(pre_edit_shot['name'], found['name']) # shouldn't be edited. - self.assertEqual(u'todo', found['properties']['status']) - self.assertEqual(u'Shoot the Pad Thai', found['description']) - self.assertNotIn(u'notes', found['properties']) + self.assertEqual('todo', found['properties']['status']) + self.assertEqual('Shoot the Pad Thai', found['description']) + self.assertNotIn('notes', found['properties']) @responses.activate def test_shot_summary(self): @@ -156,21 +156,21 @@ class PatchShotTest(AbstractShotTest): patch = { 'op': 'from-blender', '$set': { - 'name': u'"shot" is "geschoten" in Dutch', + 'name': '"shot" is "geschoten" in Dutch', 'properties.trim_start_in_frames': 123, 'properties.trim_end_in_frames': 0, 'properties.duration_in_edit_in_frames': 4215, 'properties.cut_in_timeline_in_frames': 1245, - 'properties.status': u'on_hold', + 'properties.status': 'on_hold', } } self.patch(url, json=patch, auth_token='token') dbnode = self.get(url, auth_token='token').json() - self.assertEqual(u'"shot" is "geschoten" in Dutch', dbnode['name']) + self.assertEqual('"shot" is "geschoten" in Dutch', dbnode['name']) self.assertEqual(123, dbnode['properties']['trim_start_in_frames']) self.assertEqual(0, dbnode['properties']['trim_end_in_frames']) - self.assertEqual(u'on_hold', dbnode['properties']['status']) + self.assertEqual('on_hold', dbnode['properties']['status']) @responses.activate def test_patch_activity(self): @@ -182,7 +182,7 @@ class PatchShotTest(AbstractShotTest): # Only change the name -- the activity should contain both the old and the new name. old_name = shot['name'] - new_name = u'"shot" is "geschoten" in Dutch' + new_name = '"shot" is "geschoten" in Dutch' patch = { 'op': 'from-blender', '$set': { @@ -209,20 +209,20 @@ class PatchShotTest(AbstractShotTest): patch = { 'op': 'from-web', '$set': { - 'description': u'Таким образом, этот человек заходит в бар, и говорит…', - 'properties.notes': u'Два бокала вашей лучшей водки, пожалуйста.', - 'properties.status': u'final', + 'description': 'Таким образом, этот человек заходит в бар, и говорит…', + 'properties.notes': 'Два бокала вашей лучшей водки, пожалуйста.', + 'properties.status': 'final', } } self.patch(url, json=patch, auth_token='token') dbnode = self.get(url, auth_token='token').json() - self.assertEqual(u'Таким образом, этот человек заходит в бар, и говорит…', + self.assertEqual('Таким образом, этот человек заходит в бар, и говорит…', dbnode['description']) - self.assertEqual(u'Два бокала вашей лучшей водки, пожалуйста.', + self.assertEqual('Два бокала вашей лучшей водки, пожалуйста.', dbnode['properties']['notes']) - self.assertEqual(u'final', dbnode['properties']['status']) - self.assertEqual(u'New shot', dbnode['name']) + self.assertEqual('final', dbnode['properties']['status']) + self.assertEqual('New shot', dbnode['name']) @responses.activate def test_patch_from_web_happy_nones(self): @@ -235,7 +235,7 @@ class PatchShotTest(AbstractShotTest): '$set': { 'description': None, 'properties.notes': None, - 'properties.status': u'final', + 'properties.status': 'final', } } self.patch(url, json=patch, auth_token='token') @@ -243,8 +243,8 @@ class PatchShotTest(AbstractShotTest): dbnode = self.get(url, auth_token='token').json() self.assertNotIn('description', dbnode) self.assertNotIn('notes', dbnode['properties']) - self.assertEqual(u'final', dbnode['properties']['status']) - self.assertEqual(u'New shot', dbnode['name']) + self.assertEqual('final', dbnode['properties']['status']) + self.assertEqual('New shot', dbnode['name']) @responses.activate def test_patch_bad_op(self): @@ -409,15 +409,15 @@ class RequiredAfterCreationTest(AbstractShotTest): node_type_name = node_type_shot['name'] - shot = {'name': u'test shot', - 'description': u'', - 'properties': {u'trim_start_in_frames': 0, - u'trim_end_in_frames': 0, - u'duration_in_edit_in_frames': 1, - u'cut_in_timeline_in_frames': 0}, + shot = {'name': 'test shot', + 'description': '', + 'properties': {'trim_start_in_frames': 0, + 'trim_end_in_frames': 0, + 'duration_in_edit_in_frames': 1, + 'cut_in_timeline_in_frames': 0}, 'node_type': node_type_name, - 'project': unicode(self.proj_id), - 'user': unicode(self.user_id)} + 'project': str(self.proj_id), + 'user': str(self.user_id)} resp = self.post('/api/nodes', json=shot, auth_token='token', expected_status=201) @@ -441,27 +441,27 @@ class ProjectSummaryTest(unittest.TestCase): from attract.shots_and_assets import ProjectSummary self.summ = ProjectSummary() - self.summ.count(u'todo') - self.summ.count(u'todo') - self.summ.count(u'in-progress') - self.summ.count(u'überhard') - self.summ.count(u'Æon Flux') - self.summ.count(u'Æon Flux') - self.summ.count(u'in-progress') - self.summ.count(u'todo') + self.summ.count('todo') + self.summ.count('todo') + self.summ.count('in-progress') + self.summ.count('überhard') + self.summ.count('Æon Flux') + self.summ.count('Æon Flux') + self.summ.count('in-progress') + self.summ.count('todo') def test_counting(self): self.assertEqual(8, self.summ._total) - self.assertEqual(3, self.summ._counts[u'todo']) - self.assertEqual(2, self.summ._counts[u'Æon Flux']) + self.assertEqual(3, self.summ._counts['todo']) + self.assertEqual(2, self.summ._counts['Æon Flux']) def test_percentages(self): percs = list(self.summ.percentages()) - self.assertEqual((u'in-progress', 25), percs[0]) - self.assertEqual((u'todo', 38), percs[1]) - self.assertEqual((u'Æon Flux', 25), percs[2]) + self.assertEqual(('in-progress', 25), percs[0]) + self.assertEqual(('todo', 38), percs[1]) + self.assertEqual(('Æon Flux', 25), percs[2]) # This should be rounded down, not rounded up, to ensure the sum of # percentages is 100. - self.assertEqual((u'überhard', 12), percs[3]) + self.assertEqual(('überhard', 12), percs[3]) diff --git a/tests/test_subversion.py b/tests/test_subversion.py index cf206a2..42a22ee 100644 --- a/tests/test_subversion.py +++ b/tests/test_subversion.py @@ -2,8 +2,6 @@ """Unit test for SVN interface.""" -from __future__ import absolute_import - import collections import datetime import logging.config @@ -158,48 +156,48 @@ class TestCommitLogObserver(unittest.TestCase): def test_create_log_entry(self): from attract import subversion - entry = subversion.create_log_entry(date_text=u'2016-10-21 17:40:17 +0200', - msg=u'Ünicøde is good', + entry = subversion.create_log_entry(date_text='2016-10-21 17:40:17 +0200', + msg='Ünicøde is good', revision='123', - author=u'børk', + author='børk', changelist='nothing') self.assertEqual(tuple(entry), ( datetime.datetime(2016, 10, 21, 15, 40, 17, 0, tzinfo=tzutc()), - u'Ünicøde is good', + 'Ünicøde is good', '123', - u'børk', + 'børk', 'nothing' )) self.assertRaises(ValueError, subversion.create_log_entry, date_text='Unparseable date', - msg=u'Ünicøde is good', + msg='Ünicøde is good', revision='123', - author=u'børk', + author='børk', changelist='nothing') - entry = subversion.create_log_entry(date_text=u'2016-10-21 17:40:17 +0200', - msg=u'Ünicøde is good', + entry = subversion.create_log_entry(date_text='2016-10-21 17:40:17 +0200', + msg='Ünicøde is good', revision='123', - author=u'børk') + author='børk') self.assertEqual(tuple(entry), ( datetime.datetime(2016, 10, 21, 15, 40, 17, 0, tzinfo=tzutc()), - u'Ünicøde is good', + 'Ünicøde is good', '123', - u'børk', + 'børk', None )) entry = subversion.create_log_entry( date=datetime.datetime(2016, 10, 21, 15, 40, 17, 0, tzinfo=tzutc()), - msg=u'Ünicøde is good', + msg='Ünicøde is good', revision='123', - author=u'børk') + author='børk') self.assertEqual(tuple(entry), ( datetime.datetime(2016, 10, 21, 15, 40, 17, 0, tzinfo=tzutc()), - u'Ünicøde is good', + 'Ünicøde is good', '123', - u'børk', + 'børk', None )) @@ -225,9 +223,9 @@ class PushCommitTest(AbstractAttractTest): subversion.task_logged.connect(record_blink) push_data = { - 'repo': u'strange-repo™', + 'repo': 'strange-repo™', 'revision': '4', - 'msg': u'မြန်မာဘာသာ is beautiful.\n\nThis solves task [T431134]', + 'msg': 'မြန်မာဘာသာ is beautiful.\n\nThis solves task [T431134]', 'author': 'Haha', 'date': '2016-10-21 17:40:17 +0200', } @@ -237,8 +235,8 @@ class PushCommitTest(AbstractAttractTest): auth_token=token['token']) self.assertEqual(1, len(blinks)) - self.assertEqual(u'T431134', blinks[0]['shortcode']) - self.assertEqual(u'မြန်မာဘာသာ is beautiful.\n\nThis solves task [T431134]', + self.assertEqual('T431134', blinks[0]['shortcode']) + self.assertEqual('မြန်မာဘာသာ is beautiful.\n\nThis solves task [T431134]', blinks[0]['log_entry'].msg) self.assertEqual(datetime.datetime(2016, 10, 21, 15, 40, 17, 0, tzinfo=tzutc()), blinks[0]['log_entry'].date) @@ -283,7 +281,7 @@ class SvnTaskLoggedTest(AbstractAttractTest): _, token = cli.create_svner_account('svner@example.com', self.project['url']) # Do the push - msg = u'¡is a tie! commit to task [%s]' % shortcode + msg = '¡is a tie! commit to task [%s]' % shortcode self.post('/attract/api/%s/subversion/log' % self.project['url'], json={ 'revision': 6, diff --git a/tests/test_tasks.py b/tests/test_tasks.py index 9813645..ef76e85 100644 --- a/tests/test_tasks.py +++ b/tests/test_tasks.py @@ -34,7 +34,7 @@ class TaskWorkflowTest(AbstractAttractTest): @responses.activate def test_create_task(self): - task = self.create_task(task_type=u'Just düüüh it') + task = self.create_task(task_type='Just düüüh it') self.assertIsNotNone(task) # Test directly with MongoDB @@ -42,12 +42,12 @@ class TaskWorkflowTest(AbstractAttractTest): nodes_coll = self.app.data.driver.db['nodes'] found = nodes_coll.find_one(ObjectId(task['_id'])) self.assertIsNotNone(found) - self.assertEqual(u'Just düüüh it', found['properties']['task_type']) + self.assertEqual('Just düüüh it', found['properties']['task_type']) # Test it through the API resp = self.get('/api/nodes/%s' % task['_id']) found = resp.json() - self.assertEqual(u'Just düüüh it', found['properties']['task_type']) + self.assertEqual('Just düüüh it', found['properties']['task_type']) @responses.activate def test_edit_task(self): @@ -61,15 +61,15 @@ class TaskWorkflowTest(AbstractAttractTest): self.assertRaises(sdk_exceptions.PreconditionFailed, self.mngr.edit_task, task._id, - task_type=u'je møder', - name=u'nööw name', - description=u'€ ≠ ¥', + task_type='je møder', + name='nööw name', + description='€ ≠ ¥', status='todo', _etag='jemoeder') self.mngr.edit_task(task._id, - task_type=u'je møder', - name=u'nööw name', - description=u'€ ≠ ¥', + task_type='je møder', + name='nööw name', + description='€ ≠ ¥', status='todo', _etag=task._etag) @@ -77,10 +77,10 @@ class TaskWorkflowTest(AbstractAttractTest): with self.app.test_request_context(): nodes_coll = self.app.data.driver.db['nodes'] found = nodes_coll.find_one(ObjectId(task['_id'])) - self.assertEqual(u'je møder', found['properties']['task_type']) - self.assertEqual(u'todo', found['properties']['status']) - self.assertEqual(u'nööw name', found['name']) - self.assertEqual(u'€ ≠ ¥', found['description']) + self.assertEqual('je møder', found['properties']['task_type']) + self.assertEqual('todo', found['properties']['status']) + self.assertEqual('nööw name', found['name']) + self.assertEqual('€ ≠ ¥', found['description']) @responses.activate def test_edit_activity(self): @@ -89,7 +89,7 @@ class TaskWorkflowTest(AbstractAttractTest): # Only change the name -- the activity should contain both the old and the new name. old_name = task['name'] - new_name = u'nööw name' + new_name = 'nööw name' with self.app.test_request_context(): # Log in as project admin user @@ -100,7 +100,7 @@ class TaskWorkflowTest(AbstractAttractTest): task_type=task['properties'].task_type, name=new_name, description=task.description, - status=u'todo', + status='todo', _etag=task._etag) with self.app.test_request_context(): @@ -115,8 +115,8 @@ class TaskWorkflowTest(AbstractAttractTest): def test_load_save_task(self): """Test for the Eve hooks -- we should be able to PUT what we GET.""" - task_parent = self.create_task(task_type=u'Just düüüh it') - task_child = self.create_task(task_type=u'mamaaaah', + task_parent = self.create_task(task_type='Just düüüh it') + task_child = self.create_task(task_type='mamaaaah', parent=task_parent['_id']) self.create_valid_auth_token(ctd.EXAMPLE_PROJECT_OWNER_ID, 'token')