[damned-lies] Do not use pk=1 for a User in sample_data fixture
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Do not use pk=1 for a User in sample_data fixture
- Date: Sat, 12 Feb 2011 15:04:32 +0000 (UTC)
commit 6e889ab0eeebe34943c2a033a442432a1286f383
Author: Claude Paroz <claude 2xlibre net>
Date: Sat Feb 12 15:59:50 2011 +0100
Do not use pk=1 for a User in sample_data fixture
common/views.py | 2 +-
stats/fixtures/sample_data.json | 33 ++++++++++++++++++---------------
stats/tests/fixture_factory.py | 2 ++
3 files changed, 21 insertions(+), 16 deletions(-)
---
diff --git a/common/views.py b/common/views.py
index 8617398..07cf464 100644
--- a/common/views.py
+++ b/common/views.py
@@ -40,7 +40,7 @@ def index(request):
translator_credits = translator_credits.split('\n')
curlang = Language.get_language_from_ianacode(request.LANGUAGE_CODE)
- if curlang.locale == 'en':
+ if curlang and curlang.locale == 'en':
curlang = None
context = {
diff --git a/stats/fixtures/sample_data.json b/stats/fixtures/sample_data.json
index f42143d..b0271a4 100644
--- a/stats/fixtures/sample_data.json
+++ b/stats/fixtures/sample_data.json
@@ -1,6 +1,6 @@
[
{
- "pk": 1,
+ "pk": 2,
"model": "auth.user",
"fields": {
"username": "bob",
@@ -18,7 +18,7 @@
}
},
{
- "pk": 2,
+ "pk": 3,
"model": "auth.user",
"fields": {
"username": "coord",
@@ -36,7 +36,7 @@
}
},
{
- "pk": 3,
+ "pk": 4,
"model": "auth.user",
"fields": {
"username": "alessio",
@@ -54,35 +54,35 @@
}
},
{
- "pk": 3,
+ "pk": 2,
"model": "people.person",
"fields": {
"bugzilla_account": null,
"groups": [],
"image": null,
"activation_key": null,
- "irc_nick": null,
- "svn_account": null,
+ "irc_nick": "bobby",
+ "svn_account": "bob1",
"webpage_url": null,
"user_permissions": []
}
},
{
- "pk": 1,
+ "pk": 3,
"model": "people.person",
"fields": {
"bugzilla_account": null,
"groups": [],
"image": null,
"activation_key": null,
- "irc_nick": "bobby",
- "svn_account": "bob1",
+ "irc_nick": null,
+ "svn_account": "coord_fr",
"webpage_url": null,
"user_permissions": []
}
},
{
- "pk": 2,
+ "pk": 4,
"model": "people.person",
"fields": {
"bugzilla_account": null,
@@ -90,7 +90,7 @@
"image": null,
"activation_key": null,
"irc_nick": null,
- "svn_account": "coord_fr",
+ "svn_account": null,
"webpage_url": null,
"user_permissions": []
}
@@ -155,7 +155,8 @@
"pk": 1,
"model": "teams.role",
"fields": {
- "person": 1,
+ "is_active": true,
+ "person": 2,
"role": "translator",
"team": 1
}
@@ -164,7 +165,8 @@
"pk": 2,
"model": "teams.role",
"fields": {
- "person": 2,
+ "is_active": true,
+ "person": 3,
"role": "coordinator",
"team": 1
}
@@ -173,7 +175,8 @@
"pk": 3,
"model": "teams.role",
"fields": {
- "person": 3,
+ "is_active": true,
+ "person": 4,
"role": "reviewer",
"team": 2
}
@@ -714,4 +717,4 @@
"fuzzy": 6
}
}
-]
\ No newline at end of file
+]
diff --git a/stats/tests/fixture_factory.py b/stats/tests/fixture_factory.py
index 2706fb7..83996fc 100644
--- a/stats/tests/fixture_factory.py
+++ b/stats/tests/fixture_factory.py
@@ -37,6 +37,7 @@ class FixtureFactory(TestCase):
l_it.save()
# Creating models: Persons/Roles
+ p0 = Person.objects.create(username='admin1') # Fake person (deleted below), just not to use pk=1 for user
p1 = Person(first_name='Robert', last_name='Translator',
email='bob example org', username='bob', irc_nick='bobby',
svn_account='bob1')
@@ -56,6 +57,7 @@ class FixtureFactory(TestCase):
p1.set_password('alessio')
r3 = Role(team=t2, person=p3, role='reviewer')
r3.save()
+ p0.delete()
# Creating models: Modules
gnome_hello = Module(name="gnome-hello", vcs_type="git",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]