Ran 2to3 on pillar + some manual fixups
The 'manual fixups' are: - incorrect use of dict.items() where dict.iteritems() was meant; this results in list(dict.items()), which I changed to dict.items(). - removal of 'from __future__ import' lines, which 2to3 changes into empty lines; I removed the empty lines.
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import base64
|
||||
import copy
|
||||
import json
|
||||
@@ -16,7 +12,7 @@ import sys
|
||||
try:
|
||||
from urllib.parse import urlencode
|
||||
except ImportError:
|
||||
from urllib import urlencode
|
||||
from urllib.parse import urlencode
|
||||
|
||||
from bson import ObjectId, tz_util
|
||||
|
||||
@@ -46,7 +42,7 @@ MY_PATH = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
TEST_EMAIL_USER = 'koro'
|
||||
TEST_EMAIL_ADDRESS = '%s@testing.blender.org' % TEST_EMAIL_USER
|
||||
TEST_FULL_NAME = u'врач Сергей'
|
||||
TEST_FULL_NAME = 'врач Сергей'
|
||||
TEST_SUBCLIENT_TOKEN = 'my-subclient-token-for-pillar'
|
||||
BLENDER_ID_USER_RESPONSE = {'status': 'success',
|
||||
'user': {'email': TEST_EMAIL_ADDRESS,
|
||||
@@ -207,9 +203,9 @@ class AbstractPillarTest(TestMinimal):
|
||||
'roles': list(roles),
|
||||
'settings': {'email_communications': 1},
|
||||
'auth': [{'token': '',
|
||||
'user_id': unicode(ctd.BLENDER_ID_TEST_USERID),
|
||||
'user_id': str(ctd.BLENDER_ID_TEST_USERID),
|
||||
'provider': 'blender-id'}],
|
||||
'full_name': u'คนรักของผัดไทย',
|
||||
'full_name': 'คนรักของผัดไทย',
|
||||
'email': TEST_EMAIL_ADDRESS
|
||||
})
|
||||
|
||||
|
@@ -11,55 +11,55 @@ EXAMPLE_PROJECT_READONLY_GROUP2_ID = ObjectId('564733b56dcaf85da2faee8a')
|
||||
EXAMPLE_PROJECT_ID = ObjectId('5672beecc0261b2005ed1a33')
|
||||
EXAMPLE_PROJECT_OWNER_ID = ObjectId('552b066b41acdf5dec4436f2')
|
||||
|
||||
EXAMPLE_FILE = {u'_id': ObjectId('5672e2c1c379cf0007b31995'),
|
||||
u'_updated': datetime.datetime(2016, 3, 25, 10, 28, 24, tzinfo=tz_util.utc),
|
||||
u'height': 2048,
|
||||
u'name': 'c2a5c897769ce1ef0eb10f8fa1c472bcb8e2d5a4.png', u'format': 'png',
|
||||
u'variations': [
|
||||
{u'format': 'jpg', u'height': 160, u'width': 160, u'length': 8558,
|
||||
u'link': 'http://localhost:8002/file-variant-h', u'content_type': 'image/jpeg',
|
||||
u'md5': '--', u'file_path': 'c2a5c897769ce1ef0eb10f8fa1c472bcb8e2d5a4-b.jpg',
|
||||
u'size': 'b'},
|
||||
{u'format': 'jpg', u'height': 2048, u'width': 2048, u'length': 819569,
|
||||
u'link': 'http://localhost:8002/file-variant-h', u'content_type': 'image/jpeg',
|
||||
u'md5': '--', u'file_path': 'c2a5c897769ce1ef0eb10f8fa1c472bcb8e2d5a4-h.jpg',
|
||||
u'size': 'h'},
|
||||
{u'format': 'jpg', u'height': 64, u'width': 64, u'length': 8195,
|
||||
u'link': 'http://localhost:8002/file-variant-t', u'content_type': 'image/jpeg',
|
||||
u'md5': '--', u'file_path': 'c2a5c897769ce1ef0eb10f8fa1c472bcb8e2d5a4-t.jpg',
|
||||
u'size': 't'},
|
||||
EXAMPLE_FILE = {'_id': ObjectId('5672e2c1c379cf0007b31995'),
|
||||
'_updated': datetime.datetime(2016, 3, 25, 10, 28, 24, tzinfo=tz_util.utc),
|
||||
'height': 2048,
|
||||
'name': 'c2a5c897769ce1ef0eb10f8fa1c472bcb8e2d5a4.png', 'format': 'png',
|
||||
'variations': [
|
||||
{'format': 'jpg', 'height': 160, 'width': 160, 'length': 8558,
|
||||
'link': 'http://localhost:8002/file-variant-h', 'content_type': 'image/jpeg',
|
||||
'md5': '--', 'file_path': 'c2a5c897769ce1ef0eb10f8fa1c472bcb8e2d5a4-b.jpg',
|
||||
'size': 'b'},
|
||||
{'format': 'jpg', 'height': 2048, 'width': 2048, 'length': 819569,
|
||||
'link': 'http://localhost:8002/file-variant-h', 'content_type': 'image/jpeg',
|
||||
'md5': '--', 'file_path': 'c2a5c897769ce1ef0eb10f8fa1c472bcb8e2d5a4-h.jpg',
|
||||
'size': 'h'},
|
||||
{'format': 'jpg', 'height': 64, 'width': 64, 'length': 8195,
|
||||
'link': 'http://localhost:8002/file-variant-t', 'content_type': 'image/jpeg',
|
||||
'md5': '--', 'file_path': 'c2a5c897769ce1ef0eb10f8fa1c472bcb8e2d5a4-t.jpg',
|
||||
'size': 't'},
|
||||
],
|
||||
u'filename': 'brick_dutch_soft_bump.png',
|
||||
u'project': EXAMPLE_PROJECT_ID,
|
||||
u'width': 2048, u'length': 6227670,
|
||||
u'user': ObjectId('56264fc4fa3a250344bd10c5'),
|
||||
u'content_type': 'image/png',
|
||||
u'_etag': '044ce3aede2e123e261c0d8bd77212f264d4f7b0',
|
||||
u'_created': datetime.datetime(2015, 12, 17, 16, 28, 49, tzinfo=tz_util.utc),
|
||||
u'md5': '',
|
||||
u'file_path': 'c2a5c897769ce1ef0eb10f8fa1c472bcb8e2d5a4.png',
|
||||
u'backend': 'pillar',
|
||||
u'link': 'http://localhost:8002/file',
|
||||
u'link_expires': datetime.datetime(2016, 3, 22, 9, 28, 22, tzinfo=tz_util.utc)}
|
||||
'filename': 'brick_dutch_soft_bump.png',
|
||||
'project': EXAMPLE_PROJECT_ID,
|
||||
'width': 2048, 'length': 6227670,
|
||||
'user': ObjectId('56264fc4fa3a250344bd10c5'),
|
||||
'content_type': 'image/png',
|
||||
'_etag': '044ce3aede2e123e261c0d8bd77212f264d4f7b0',
|
||||
'_created': datetime.datetime(2015, 12, 17, 16, 28, 49, tzinfo=tz_util.utc),
|
||||
'md5': '',
|
||||
'file_path': 'c2a5c897769ce1ef0eb10f8fa1c472bcb8e2d5a4.png',
|
||||
'backend': 'pillar',
|
||||
'link': 'http://localhost:8002/file',
|
||||
'link_expires': datetime.datetime(2016, 3, 22, 9, 28, 22, tzinfo=tz_util.utc)}
|
||||
|
||||
EXAMPLE_PROJECT = {
|
||||
u'_created': datetime.datetime(2015, 12, 17, 13, 22, 56, tzinfo=tz_util.utc),
|
||||
u'_etag': u'cc4643e98d3606f87bbfaaa200bfbae941b642f3',
|
||||
u'_id': EXAMPLE_PROJECT_ID,
|
||||
u'_updated': datetime.datetime(2016, 1, 7, 18, 59, 4, tzinfo=tz_util.utc),
|
||||
u'category': u'assets',
|
||||
u'description': u'Welcome to this curated collection of Blender Institute textures and image '
|
||||
u'resources. This collection is an on-going project, as with each project we '
|
||||
u'create a number of textures based on our own resources (photographs, scans, '
|
||||
u'etc.) or made completely from scratch. At the moment you can find all the '
|
||||
u'textures from the past Open Projects that were deemed re-usable. \r\n\r\n'
|
||||
u'People who have contributed to these textures:\r\n\r\nAndrea Weikert, Andy '
|
||||
u'Goralczyk, Basse Salmela, Ben Dansie, Campbell Barton, Enrico Valenza, Ian '
|
||||
u'Hubert, Kjartan Tysdal, Manu J\xe4rvinen, Massimiliana Pulieso, Matt Ebb, '
|
||||
u'Pablo Vazquez, Rob Tuytel, Roland Hess, Sarah Feldlaufer, S\xf6nke M\xe4ter',
|
||||
u'is_private': False,
|
||||
u'name': u'Unittest project',
|
||||
u'node_types': [
|
||||
'_created': datetime.datetime(2015, 12, 17, 13, 22, 56, tzinfo=tz_util.utc),
|
||||
'_etag': 'cc4643e98d3606f87bbfaaa200bfbae941b642f3',
|
||||
'_id': EXAMPLE_PROJECT_ID,
|
||||
'_updated': datetime.datetime(2016, 1, 7, 18, 59, 4, tzinfo=tz_util.utc),
|
||||
'category': 'assets',
|
||||
'description': 'Welcome to this curated collection of Blender Institute textures and image '
|
||||
'resources. This collection is an on-going project, as with each project we '
|
||||
'create a number of textures based on our own resources (photographs, scans, '
|
||||
'etc.) or made completely from scratch. At the moment you can find all the '
|
||||
'textures from the past Open Projects that were deemed re-usable. \r\n\r\n'
|
||||
'People who have contributed to these textures:\r\n\r\nAndrea Weikert, Andy '
|
||||
'Goralczyk, Basse Salmela, Ben Dansie, Campbell Barton, Enrico Valenza, Ian '
|
||||
'Hubert, Kjartan Tysdal, Manu J\xe4rvinen, Massimiliana Pulieso, Matt Ebb, '
|
||||
'Pablo Vazquez, Rob Tuytel, Roland Hess, Sarah Feldlaufer, S\xf6nke M\xe4ter',
|
||||
'is_private': False,
|
||||
'name': 'Unittest project',
|
||||
'node_types': [
|
||||
PILLAR_NAMED_NODE_TYPES['group_texture'],
|
||||
PILLAR_NAMED_NODE_TYPES['group'],
|
||||
PILLAR_NAMED_NODE_TYPES['asset'],
|
||||
@@ -69,36 +69,36 @@ EXAMPLE_PROJECT = {
|
||||
PILLAR_NAMED_NODE_TYPES['post'],
|
||||
PILLAR_NAMED_NODE_TYPES['texture'],
|
||||
],
|
||||
u'nodes_blog': [],
|
||||
u'nodes_featured': [],
|
||||
u'nodes_latest': [],
|
||||
u'permissions': {u'groups': [{u'group': EXAMPLE_ADMIN_GROUP_ID,
|
||||
u'methods': [u'GET', u'POST', u'PUT', u'DELETE']}],
|
||||
u'users': [],
|
||||
u'world': [u'GET']},
|
||||
u'picture_header': ObjectId('5673f260c379cf0007b31bc4'),
|
||||
u'picture_square': ObjectId('5673f256c379cf0007b31bc3'),
|
||||
u'status': u'published',
|
||||
u'summary': u'Texture collection from all Blender Institute open projects.',
|
||||
u'url': u'textures',
|
||||
u'user': EXAMPLE_PROJECT_OWNER_ID}
|
||||
'nodes_blog': [],
|
||||
'nodes_featured': [],
|
||||
'nodes_latest': [],
|
||||
'permissions': {'groups': [{'group': EXAMPLE_ADMIN_GROUP_ID,
|
||||
'methods': ['GET', 'POST', 'PUT', 'DELETE']}],
|
||||
'users': [],
|
||||
'world': ['GET']},
|
||||
'picture_header': ObjectId('5673f260c379cf0007b31bc4'),
|
||||
'picture_square': ObjectId('5673f256c379cf0007b31bc3'),
|
||||
'status': 'published',
|
||||
'summary': 'Texture collection from all Blender Institute open projects.',
|
||||
'url': 'textures',
|
||||
'user': EXAMPLE_PROJECT_OWNER_ID}
|
||||
|
||||
EXAMPLE_NODE = {
|
||||
u'_id': ObjectId('572761099837730efe8e120d'),
|
||||
u'picture': ObjectId('572761f39837730efe8e1210'),
|
||||
u'description': u'',
|
||||
u'node_type': u'asset',
|
||||
u'user': ObjectId('57164ca1983773118cbaf779'),
|
||||
u'properties': {
|
||||
u'status': u'published',
|
||||
u'content_type': u'image',
|
||||
u'file': ObjectId('572761129837730efe8e120e')
|
||||
'_id': ObjectId('572761099837730efe8e120d'),
|
||||
'picture': ObjectId('572761f39837730efe8e1210'),
|
||||
'description': '',
|
||||
'node_type': 'asset',
|
||||
'user': ObjectId('57164ca1983773118cbaf779'),
|
||||
'properties': {
|
||||
'status': 'published',
|
||||
'content_type': 'image',
|
||||
'file': ObjectId('572761129837730efe8e120e')
|
||||
},
|
||||
u'_updated': datetime.datetime(2016, 5, 2, 14, 19, 58, 0, tzinfo=tz_util.utc),
|
||||
u'name': u'Image test',
|
||||
u'project': EXAMPLE_PROJECT_ID,
|
||||
u'_created': datetime.datetime(2016, 5, 2, 14, 19, 37, 0, tzinfo=tz_util.utc),
|
||||
u'_etag': u'6b8589b42c880e3626f43f3e82a5c5b946742687'
|
||||
'_updated': datetime.datetime(2016, 5, 2, 14, 19, 58, 0, tzinfo=tz_util.utc),
|
||||
'name': 'Image test',
|
||||
'project': EXAMPLE_PROJECT_ID,
|
||||
'_created': datetime.datetime(2016, 5, 2, 14, 19, 37, 0, tzinfo=tz_util.utc),
|
||||
'_etag': '6b8589b42c880e3626f43f3e82a5c5b946742687'
|
||||
}
|
||||
|
||||
BLENDER_ID_TEST_USERID = 1533
|
||||
|
@@ -8,4 +8,4 @@ TESTING = True
|
||||
CDN_STORAGE_USER = 'u41508580125621'
|
||||
|
||||
FILESIZE_LIMIT_BYTES_NONSUBS = 20 * 2 ** 10
|
||||
ROLES_FOR_UNLIMITED_UPLOADS = {u'subscriber', u'demo', u'admin'}
|
||||
ROLES_FOR_UNLIMITED_UPLOADS = {'subscriber', 'demo', 'admin'}
|
||||
|
Reference in New Issue
Block a user