smaller absolute fixtures are faster

This commit is contained in:
Andy McKay 2012-12-03 09:59:35 -08:00
Родитель df5208464a
Коммит 0c0c98d1e5
10 изменённых файлов: 390 добавлений и 16 удалений

Просмотреть файл

@ -14,13 +14,13 @@ from amo.tests import AMOPaths
from files.models import FileUpload
from mkt.api.tests.test_oauth import BaseOAuth, OAuthClient
from mkt.constants import APP_IMAGE_SIZES
from mkt.developers import tasks
from mkt.site.fixtures import fixture
from mkt.webapps.models import ImageAsset, Webapp
from users.models import UserProfile
class ValidationHandler(BaseOAuth):
fixtures = ['base/user_2519', 'base/users']
fixtures = fixture('user_2519', 'user_admin')
def setUp(self):
super(ValidationHandler, self).setUp()
@ -197,7 +197,7 @@ class TestGetValidationHandler(ValidationHandler):
class CreateHandler(BaseOAuth):
fixtures = ['base/user_2519', 'base/users', 'base/platforms']
fixtures = fixture('user_2519', 'platform_all')
def setUp(self):
super(CreateHandler, self).setUp()
@ -224,9 +224,8 @@ def _mock_fetch_content(url):
@patch.object(settings, 'SITE_URL', 'http://api/')
class TestAppCreateHandler(CreateHandler, AMOPaths):
fixtures = ['base/user_2519', 'base/users',
'base/platforms', 'base/apps', 'base/appversion']
fixtures = fixture('app_firefox', 'platform_all', 'user_admin',
'user_2519',)
def count(self):
return Addon.objects.count()
@ -410,7 +409,7 @@ class TestAppCreateHandler(CreateHandler, AMOPaths):
class CreatePackagedHandler(amo.tests.AMOPaths, BaseOAuth):
fixtures = ['base/user_2519', 'base/users', 'base/platforms']
fixtures = fixture('user_2519', 'platform_all')
def setUp(self):
super(CreatePackagedHandler, self).setUp()
@ -430,8 +429,7 @@ class CreatePackagedHandler(amo.tests.AMOPaths, BaseOAuth):
@patch.object(settings, 'SITE_URL', 'http://api/')
class TestPackagedAppCreateHandler(CreatePackagedHandler):
fixtures = ['base/user_2519', 'base/users',
'base/platforms', 'base/apps', 'base/appversion']
fixtures = fixture('user_2519', 'platform_all')
def test_create(self):
obj = self.create()
@ -448,9 +446,7 @@ class TestPackagedAppCreateHandler(CreatePackagedHandler):
@patch.object(settings, 'SITE_URL', 'http://api/')
class TestListHandler(CreateHandler, AMOPaths):
fixtures = ['base/user_2519', 'base/users',
'base/platforms', 'base/appversion']
fixtures = fixture('user_2519', 'user_999', 'platform_all')
def create(self, users):
app = Addon.objects.create(type=amo.ADDON_WEBAPP)
@ -484,9 +480,7 @@ class TestListHandler(CreateHandler, AMOPaths):
@patch.object(settings, 'SITE_URL', 'http://api/')
class TestAppStatusHandler(CreateHandler, AMOPaths):
fixtures = ['base/user_2519', 'base/users',
'base/platforms', 'base/appversion']
fixtures = fixture('user_2519', 'platform_all')
def setUp(self):
super(TestAppStatusHandler, self).setUp()
@ -609,7 +603,7 @@ class TestCategoryHandler(BaseOAuth):
@patch.object(settings, 'SITE_URL', 'http://api/')
class TestPreviewHandler(BaseOAuth, AMOPaths):
fixtures = ['base/users', 'base/user_2519', 'webapps/337141-steamcube']
fixtures = fixture('user_2519', 'webapp_337141')
def setUp(self):
super(TestPreviewHandler, self).setUp()

Просмотреть файл

@ -0,0 +1,8 @@
import os
from django.conf import settings
def fixture(*names):
return [os.path.join(settings.ROOT, 'mkt/site/fixtures/data', n)
for n in names]

Просмотреть файл

@ -0,0 +1,11 @@
[
{
"pk": 1,
"model": "applications.application",
"fields": {
"guid": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
"modified": "2008-11-03 15:34:59",
"created": "2007-03-05 13:09:26"
}
}
]

Просмотреть файл

@ -0,0 +1,12 @@
[
{
"pk": 1,
"model": "access.group",
"fields": {
"rules": "*:*",
"name": "Admins",
"created": "2007-03-05 16:06:55",
"modified": "2007-03-05 16:06:55"
}
}
]

Просмотреть файл

@ -0,0 +1,10 @@
[
{
"pk": 1,
"model": "files.platform",
"fields": {
"modified": "2008-04-07 08:16:55",
"created": "2007-03-05 13:09:27"
}
}
]

Просмотреть файл

@ -0,0 +1,49 @@
[
{
"pk": 2519,
"model": "auth.user",
"fields": {
"username": "cfinke@m.com",
"first_name": "Christopher",
"last_name": "Finke",
"is_active": true,
"is_superuser": false,
"is_staff": false,
"last_login": "2010-05-19 06:28:40",
"groups": [],
"user_permissions": [],
"password": "",
"email": "cfinke@m.com",
"date_joined": "2007-03-05 13:09:34"
}
},
{
"pk": 2519,
"model": "users.userprofile",
"fields": {
"display_collections_fav": false,
"display_collections": false,
"occupation": "Software Developer",
"confirmationcode": "",
"location": "Minneapolis, MN",
"picture_type": "image/png",
"averagerating": "4.09",
"homepage": "http://www.chrisfinke.com/",
"email": "dd+357b3dde1@davedash.com",
"notifycompat": true,
"bio": null,
"deleted": false,
"emailhidden": false,
"user": 2519,
"password": "",
"username": "cfinke",
"display_name": "cfinke \u0627\u0644\u062a\u0637\u0628",
"resetcode_expires": null,
"resetcode": "",
"created": "2007-03-05 13:09:34",
"notes": null,
"modified": "2010-05-07 15:22:13",
"notifyevents": true
}
}
]

Просмотреть файл

@ -0,0 +1,49 @@
[
{
"pk": 999,
"model": "auth.user",
"fields": {
"username": "regular@mozilla.com",
"first_name": "Regular",
"last_name": "User",
"is_active": 1,
"is_superuser": 0,
"is_staff": 0,
"last_login": "2010-04-23 10:33:53",
"groups": [],
"user_permissions": [],
"password": "sha1$a04e0$0512298efb3e6e7dbace3976474151d396078fdd",
"email": "regular@mozilla.com",
"date_joined": "2007-03-05 13:09:38"
}
},
{
"fields": {
"display_collections_fav": 1,
"display_collections": 1,
"occupation": "",
"confirmationcode": "",
"location": "",
"picture_type": "",
"averagerating": "",
"homepage": "",
"email": "regular@mozilla.com",
"notifycompat": 1,
"bio": null,
"deleted": 0,
"emailhidden": 0,
"password": "sha512$7b5436061f8c0902088c292c057be69fdb17312e2f71607c9c51641f5d876522$08d1d370d89e2ae92755fd03464a7276ca607c431d04a52d659f7a184f3f9918073637d82fc88981c7099c7c46a1137b9fdeb675304eb98801038905a9ee0600",
"username": "regularuser",
"display_name": "regularuser \u0627\u0644\u062a\u0637\u0628",
"resetcode_expires": "2010-01-12 15:28:07",
"resetcode": "",
"created": "2009-02-02 11:50:31",
"notes": "",
"modified": "2010-01-12 17:01:41",
"notifyevents": 1,
"read_dev_agreement": "2012-08-20 00:00:00"
},
"model": "users.userprofile",
"pk": 999
}
]

Просмотреть файл

@ -0,0 +1,50 @@
[
{
"fields": {
"username": "admin",
"first_name": "Jeff",
"last_name": "Balogh",
"is_active": 1,
"is_superuser": 1,
"is_staff": 1,
"last_login": "2010-01-13 17:17:23",
"groups": [],
"user_permissions": [],
"password": "sha512$7b5436061f8c0902088c292c057be69fdb17312e2f71607c9c51641f5d876522$08d1d370d89e2ae92755fd03464a7276ca607c431d04a52d659f7a184f3f9918073637d82fc88981c7099c7c46a1137b9fdeb675304eb98801038905a9ee0600",
"email": "admin@mozilla.com",
"date_joined": "2009-02-02 11:50:31"
},
"model": "auth.user",
"pk": 4043307
},
{
"fields": {
"display_collections_fav": 1,
"display_collections": 1,
"occupation": "",
"confirmationcode": "",
"location": "",
"picture_type": "",
"averagerating": "",
"homepage": "http://jeffbalogh.org",
"email": "admin@mozilla.com",
"notifycompat": 1,
"bio": null,
"deleted": 0,
"emailhidden": 0,
"user": 4043307,
"password": "sha512$7b5436061f8c0902088c292c057be69fdb17312e2f71607c9c51641f5d876522$08d1d370d89e2ae92755fd03464a7276ca607c431d04a52d659f7a184f3f9918073637d82fc88981c7099c7c46a1137b9fdeb675304eb98801038905a9ee0600",
"username": "admin",
"display_name": "admin \u0627\u0644\u062a\u0637\u0628",
"resetcode_expires": "2010-01-12 15:28:07",
"resetcode": "",
"created": "2009-02-02 11:50:31",
"notes": "",
"modified": "2010-01-12 17:01:41",
"notifyevents": 1,
"read_dev_agreement": "2012-08-20 00:00:00"
},
"model": "users.userprofile",
"pk": 4043307
}
]

Просмотреть файл

@ -0,0 +1,10 @@
[
{
"pk": 10,
"model": "access.groupuser",
"fields": {
"group": 1,
"user": 4043307
}
}
]

Просмотреть файл

@ -0,0 +1,181 @@
[
{
"pk": 337141,
"model": "addons.addon",
"fields": {
"dev_agreement": false,
"eula": null,
"last_updated": "2011-10-18 16:28:24",
"view_source": true,
"enable_thankyou": false,
"total_downloads": 0,
"premium_type": 0,
"app_slug": "something-something",
"developer_comments": null,
"_current_version": 1268829,
"average_daily_downloads": 0,
"_backup_version": null,
"manifest_url": "http://micropipes.com/temp/steamcube.webapp",
"app_domain": "micropipes.com",
"admin_review_type": 1,
"the_future": null,
"trusted": false,
"total_contributions": null,
"locale_disambiguation": null,
"guid": null,
"weekly_downloads": 9999,
"support_url": null,
"disabled_by_user": false,
"paypal_id": "",
"average_rating": 0.0,
"wants_contributions": false,
"average_daily_users": 0,
"bayesian_rating": 0.0,
"share_count": 0,
"ts_slowness": null,
"homepage": null,
"support_email": null,
"public_stats": false,
"status": 4,
"privacy_policy": 2326784,
"description": null,
"default_locale": "en-US",
"target_locale": null,
"suggested_amount": null,
"get_satisfaction_product": null,
"prerelease": false,
"thankyou_note": null,
"admin_review": false,
"auto_repackage": true,
"slug": "app-337141",
"external_software": false,
"highest_status": 4,
"get_satisfaction_company": null,
"name": 2425897,
"created": "2011-10-18 16:28:24",
"type": 11,
"icon_type": "image/png",
"annoying": 0,
"modified": "2011-10-18 16:29:46",
"summary": 2425897,
"nomination_message": null,
"site_specific": false,
"charity": null,
"total_reviews": 0,
"the_reason": null,
"hotness": 0.0
}
},
{
"pk": 1268829,
"model": "versions.version",
"fields": {
"has_info_request": false,
"license": null,
"created": "2011-10-18 16:28:24",
"has_editor_comment": false,
"releasenotes": null,
"approvalnotes": "",
"modified": "2011-10-18 16:28:24",
"version": "1.0",
"version_int": 1000000200100,
"reviewed": null,
"nomination": null,
"addon": 337141
}
},
{
"pk": 1,
"model": "files.platform",
"fields": {
"modified": "2008-04-07 08:16:55",
"created": "2007-03-05 13:09:27"
}
},
{
"pk": 81555,
"model": "files.file",
"fields": {
"status": 4,
"codereview": false,
"hash": "sha256:3808b13ef8341378b9c8305ca648200954ee7dcd8dce09fef55f2673458bc31f",
"created": "2009-10-21 09:58:52",
"modified": "2009-10-21 10:02:38",
"filename": "steamcube.webapp",
"platform": 1,
"version": 1268829,
"size": 388096,
"datestatuschanged": "2009-10-21 09:58:40"
}
},
{
"pk": 2527085,
"model": "translations.translation",
"fields": {
"localized_string_clean": null,
"created": "2011-10-18 16:28:24",
"locale": "en-US",
"modified": "2011-10-18 16:28:57",
"id": 2425897,
"localized_string": "Something Something Steamcube!"
}
},
{
"pk": 31337,
"model": "auth.user",
"fields": {
"username": "steamcube@mozilla.com",
"first_name": "Leet",
"last_name": "User",
"is_active": true,
"is_superuser": false,
"is_staff": false,
"last_login": "2010-05-20 13:00:37",
"groups": [],
"user_permissions": [],
"password": "",
"email": "steamcube@mozilla.com",
"date_joined": "2007-03-05 13:09:56"
}
},
{
"pk": 31337,
"model": "users.userprofile",
"fields": {
"display_collections_fav": false,
"display_collections": false,
"averagerating": "3.11",
"confirmationcode": "",
"notifycompat": true,
"picture_type": "",
"occupation": "",
"homepage": "",
"email": "steamcube@mozilla.com",
"location": "",
"bio": null,
"deleted": false,
"emailhidden": true,
"user": 31337,
"password": "sha512$7b5436061f8c0902088c292c057be69fdb17312e2f71607c9c51641f5d876522$08d1d370d89e2ae92755fd03464a7276ca607c431d04a52d659f7a184f3f9918073637d82fc88981c7099c7c46a1137b9fdeb675304eb98801038905a9ee0600",
"username": "31337",
"display_name": "31337 \u0627\u0644\u062a\u0637\u0628",
"resetcode_expires": null,
"resetcode": "",
"created": "2007-03-05 13:09:56",
"notes": null,
"modified": "2010-05-19 16:41:22",
"notifyevents": true
}
},
{
"pk": 2818,
"model": "addons.addonuser",
"fields": {
"position": 0,
"addon": 337141,
"role": 5,
"listed": true,
"user": 31337
}
}
]