From 02bc523b89ae6fb37c26ce8d6424cb84751ad3ac Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Sun, 27 Nov 2011 10:31:26 +0000 Subject: Renamed the fixtures used by the aggregation tests so they're only loaded by the tests that use them. Refs #17275. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17153 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- .../aggregation/fixtures/aggregation.json | 243 +++++++++++++++++++ .../aggregation/fixtures/initial_data.json | 243 ------------------- tests/modeltests/aggregation/tests.py | 2 +- .../fixtures/aggregation_regress.json | 257 +++++++++++++++++++++ .../aggregation_regress/fixtures/initial_data.json | 257 --------------------- tests/regressiontests/aggregation_regress/tests.py | 2 + 6 files changed, 503 insertions(+), 501 deletions(-) create mode 100644 tests/modeltests/aggregation/fixtures/aggregation.json delete mode 100644 tests/modeltests/aggregation/fixtures/initial_data.json create mode 100644 tests/regressiontests/aggregation_regress/fixtures/aggregation_regress.json delete mode 100644 tests/regressiontests/aggregation_regress/fixtures/initial_data.json diff --git a/tests/modeltests/aggregation/fixtures/aggregation.json b/tests/modeltests/aggregation/fixtures/aggregation.json new file mode 100644 index 0000000000..a0021001e7 --- /dev/null +++ b/tests/modeltests/aggregation/fixtures/aggregation.json @@ -0,0 +1,243 @@ +[ + { + "pk": 1, + "model": "aggregation.publisher", + "fields": { + "name": "Apress", + "num_awards": 3 + } + }, + { + "pk": 2, + "model": "aggregation.publisher", + "fields": { + "name": "Sams", + "num_awards": 1 + } + }, + { + "pk": 3, + "model": "aggregation.publisher", + "fields": { + "name": "Prentice Hall", + "num_awards": 7 + } + }, + { + "pk": 4, + "model": "aggregation.publisher", + "fields": { + "name": "Morgan Kaufmann", + "num_awards": 9 + } + }, + { + "pk": 5, + "model": "aggregation.publisher", + "fields": { + "name": "Jonno's House of Books", + "num_awards": 0 + } + }, + { + "pk": 1, + "model": "aggregation.book", + "fields": { + "publisher": 1, + "isbn": "159059725", + "name": "The Definitive Guide to Django: Web Development Done Right", + "price": "30.00", + "rating": 4.5, + "authors": [1, 2], + "contact": 1, + "pages": 447, + "pubdate": "2007-12-6" + } + }, + { + "pk": 2, + "model": "aggregation.book", + "fields": { + "publisher": 2, + "isbn": "067232959", + "name": "Sams Teach Yourself Django in 24 Hours", + "price": "23.09", + "rating": 3.0, + "authors": [3], + "contact": 3, + "pages": 528, + "pubdate": "2008-3-3" + } + }, + { + "pk": 3, + "model": "aggregation.book", + "fields": { + "publisher": 1, + "isbn": "159059996", + "name": "Practical Django Projects", + "price": "29.69", + "rating": 4.0, + "authors": [4], + "contact": 4, + "pages": 300, + "pubdate": "2008-6-23" + } + }, + { + "pk": 4, + "model": "aggregation.book", + "fields": { + "publisher": 3, + "isbn": "013235613", + "name": "Python Web Development with Django", + "price": "29.69", + "rating": 4.0, + "authors": [5, 6, 7], + "contact": 5, + "pages": 350, + "pubdate": "2008-11-3" + } + }, + { + "pk": 5, + "model": "aggregation.book", + "fields": { + "publisher": 3, + "isbn": "013790395", + "name": "Artificial Intelligence: A Modern Approach", + "price": "82.80", + "rating": 4.0, + "authors": [8, 9], + "contact": 8, + "pages": 1132, + "pubdate": "1995-1-15" + } + }, + { + "pk": 6, + "model": "aggregation.book", + "fields": { + "publisher": 4, + "isbn": "155860191", + "name": "Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp", + "price": "75.00", + "rating": 5.0, + "authors": [8], + "contact": 8, + "pages": 946, + "pubdate": "1991-10-15" + } + }, + { + "pk": 1, + "model": "aggregation.store", + "fields": { + "books": [1, 2, 3, 4, 5, 6], + "name": "Amazon.com", + "original_opening": "1994-4-23 9:17:42", + "friday_night_closing": "23:59:59" + } + }, + { + "pk": 2, + "model": "aggregation.store", + "fields": { + "books": [1, 3, 5, 6], + "name": "Books.com", + "original_opening": "2001-3-15 11:23:37", + "friday_night_closing": "23:59:59" + } + }, + { + "pk": 3, + "model": "aggregation.store", + "fields": { + "books": [3, 4, 6], + "name": "Mamma and Pappa's Books", + "original_opening": "1945-4-25 16:24:14", + "friday_night_closing": "21:30:00" + } + }, + { + "pk": 1, + "model": "aggregation.author", + "fields": { + "age": 34, + "friends": [2, 4], + "name": "Adrian Holovaty" + } + }, + { + "pk": 2, + "model": "aggregation.author", + "fields": { + "age": 35, + "friends": [1, 7], + "name": "Jacob Kaplan-Moss" + } + }, + { + "pk": 3, + "model": "aggregation.author", + "fields": { + "age": 45, + "friends": [], + "name": "Brad Dayley" + } + }, + { + "pk": 4, + "model": "aggregation.author", + "fields": { + "age": 29, + "friends": [1], + "name": "James Bennett" + } + }, + { + "pk": 5, + "model": "aggregation.author", + "fields": { + "age": 37, + "friends": [6, 7], + "name": "Jeffrey Forcier" + } + }, + { + "pk": 6, + "model": "aggregation.author", + "fields": { + "age": 29, + "friends": [5, 7], + "name": "Paul Bissex" + } + }, + { + "pk": 7, + "model": "aggregation.author", + "fields": { + "age": 25, + "friends": [2, 5, 6], + "name": "Wesley J. Chun" + } + }, + { + "pk": 8, + "model": "aggregation.author", + "fields": { + "age": 57, + "friends": [9], + "name": "Peter Norvig" + } + }, + { + "pk": 9, + "model": "aggregation.author", + "fields": { + "age": 46, + "friends": [8], + "name": "Stuart Russell" + } + } +] diff --git a/tests/modeltests/aggregation/fixtures/initial_data.json b/tests/modeltests/aggregation/fixtures/initial_data.json deleted file mode 100644 index a0021001e7..0000000000 --- a/tests/modeltests/aggregation/fixtures/initial_data.json +++ /dev/null @@ -1,243 +0,0 @@ -[ - { - "pk": 1, - "model": "aggregation.publisher", - "fields": { - "name": "Apress", - "num_awards": 3 - } - }, - { - "pk": 2, - "model": "aggregation.publisher", - "fields": { - "name": "Sams", - "num_awards": 1 - } - }, - { - "pk": 3, - "model": "aggregation.publisher", - "fields": { - "name": "Prentice Hall", - "num_awards": 7 - } - }, - { - "pk": 4, - "model": "aggregation.publisher", - "fields": { - "name": "Morgan Kaufmann", - "num_awards": 9 - } - }, - { - "pk": 5, - "model": "aggregation.publisher", - "fields": { - "name": "Jonno's House of Books", - "num_awards": 0 - } - }, - { - "pk": 1, - "model": "aggregation.book", - "fields": { - "publisher": 1, - "isbn": "159059725", - "name": "The Definitive Guide to Django: Web Development Done Right", - "price": "30.00", - "rating": 4.5, - "authors": [1, 2], - "contact": 1, - "pages": 447, - "pubdate": "2007-12-6" - } - }, - { - "pk": 2, - "model": "aggregation.book", - "fields": { - "publisher": 2, - "isbn": "067232959", - "name": "Sams Teach Yourself Django in 24 Hours", - "price": "23.09", - "rating": 3.0, - "authors": [3], - "contact": 3, - "pages": 528, - "pubdate": "2008-3-3" - } - }, - { - "pk": 3, - "model": "aggregation.book", - "fields": { - "publisher": 1, - "isbn": "159059996", - "name": "Practical Django Projects", - "price": "29.69", - "rating": 4.0, - "authors": [4], - "contact": 4, - "pages": 300, - "pubdate": "2008-6-23" - } - }, - { - "pk": 4, - "model": "aggregation.book", - "fields": { - "publisher": 3, - "isbn": "013235613", - "name": "Python Web Development with Django", - "price": "29.69", - "rating": 4.0, - "authors": [5, 6, 7], - "contact": 5, - "pages": 350, - "pubdate": "2008-11-3" - } - }, - { - "pk": 5, - "model": "aggregation.book", - "fields": { - "publisher": 3, - "isbn": "013790395", - "name": "Artificial Intelligence: A Modern Approach", - "price": "82.80", - "rating": 4.0, - "authors": [8, 9], - "contact": 8, - "pages": 1132, - "pubdate": "1995-1-15" - } - }, - { - "pk": 6, - "model": "aggregation.book", - "fields": { - "publisher": 4, - "isbn": "155860191", - "name": "Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp", - "price": "75.00", - "rating": 5.0, - "authors": [8], - "contact": 8, - "pages": 946, - "pubdate": "1991-10-15" - } - }, - { - "pk": 1, - "model": "aggregation.store", - "fields": { - "books": [1, 2, 3, 4, 5, 6], - "name": "Amazon.com", - "original_opening": "1994-4-23 9:17:42", - "friday_night_closing": "23:59:59" - } - }, - { - "pk": 2, - "model": "aggregation.store", - "fields": { - "books": [1, 3, 5, 6], - "name": "Books.com", - "original_opening": "2001-3-15 11:23:37", - "friday_night_closing": "23:59:59" - } - }, - { - "pk": 3, - "model": "aggregation.store", - "fields": { - "books": [3, 4, 6], - "name": "Mamma and Pappa's Books", - "original_opening": "1945-4-25 16:24:14", - "friday_night_closing": "21:30:00" - } - }, - { - "pk": 1, - "model": "aggregation.author", - "fields": { - "age": 34, - "friends": [2, 4], - "name": "Adrian Holovaty" - } - }, - { - "pk": 2, - "model": "aggregation.author", - "fields": { - "age": 35, - "friends": [1, 7], - "name": "Jacob Kaplan-Moss" - } - }, - { - "pk": 3, - "model": "aggregation.author", - "fields": { - "age": 45, - "friends": [], - "name": "Brad Dayley" - } - }, - { - "pk": 4, - "model": "aggregation.author", - "fields": { - "age": 29, - "friends": [1], - "name": "James Bennett" - } - }, - { - "pk": 5, - "model": "aggregation.author", - "fields": { - "age": 37, - "friends": [6, 7], - "name": "Jeffrey Forcier" - } - }, - { - "pk": 6, - "model": "aggregation.author", - "fields": { - "age": 29, - "friends": [5, 7], - "name": "Paul Bissex" - } - }, - { - "pk": 7, - "model": "aggregation.author", - "fields": { - "age": 25, - "friends": [2, 5, 6], - "name": "Wesley J. Chun" - } - }, - { - "pk": 8, - "model": "aggregation.author", - "fields": { - "age": 57, - "friends": [9], - "name": "Peter Norvig" - } - }, - { - "pk": 9, - "model": "aggregation.author", - "fields": { - "age": 46, - "friends": [8], - "name": "Stuart Russell" - } - } -] diff --git a/tests/modeltests/aggregation/tests.py b/tests/modeltests/aggregation/tests.py index 6c1c608d80..a35dbb345f 100644 --- a/tests/modeltests/aggregation/tests.py +++ b/tests/modeltests/aggregation/tests.py @@ -10,7 +10,7 @@ from .models import Author, Publisher, Book, Store class BaseAggregateTestCase(TestCase): - fixtures = ["initial_data.json"] + fixtures = ["aggregation.json"] def test_empty_aggregate(self): self.assertEqual(Author.objects.all().aggregate(), {}) diff --git a/tests/regressiontests/aggregation_regress/fixtures/aggregation_regress.json b/tests/regressiontests/aggregation_regress/fixtures/aggregation_regress.json new file mode 100644 index 0000000000..597ac041f7 --- /dev/null +++ b/tests/regressiontests/aggregation_regress/fixtures/aggregation_regress.json @@ -0,0 +1,257 @@ +[ + { + "pk": 1, + "model": "aggregation_regress.publisher", + "fields": { + "name": "Apress", + "num_awards": 3 + } + }, + { + "pk": 2, + "model": "aggregation_regress.publisher", + "fields": { + "name": "Sams", + "num_awards": 1 + } + }, + { + "pk": 3, + "model": "aggregation_regress.publisher", + "fields": { + "name": "Prentice Hall", + "num_awards": 7 + } + }, + { + "pk": 4, + "model": "aggregation_regress.publisher", + "fields": { + "name": "Morgan Kaufmann", + "num_awards": 9 + } + }, + { + "pk": 5, + "model": "aggregation_regress.publisher", + "fields": { + "name": "Jonno's House of Books", + "num_awards": 0 + } + }, + { + "pk": 1, + "model": "aggregation_regress.book", + "fields": { + "publisher": 1, + "isbn": "159059725", + "name": "The Definitive Guide to Django: Web Development Done Right", + "price": "30.00", + "rating": 4.5, + "authors": [1, 2], + "contact": 1, + "pages": 447, + "pubdate": "2007-12-6" + } + }, + { + "pk": 2, + "model": "aggregation_regress.book", + "fields": { + "publisher": 2, + "isbn": "067232959", + "name": "Sams Teach Yourself Django in 24 Hours", + "price": "23.09", + "rating": 3.0, + "authors": [3], + "contact": 3, + "pages": 528, + "pubdate": "2008-3-3" + } + }, + { + "pk": 3, + "model": "aggregation_regress.book", + "fields": { + "publisher": 1, + "isbn": "159059996", + "name": "Practical Django Projects", + "price": "29.69", + "rating": 4.0, + "authors": [4], + "contact": 4, + "pages": 300, + "pubdate": "2008-6-23" + } + }, + { + "pk": 4, + "model": "aggregation_regress.book", + "fields": { + "publisher": 3, + "isbn": "013235613", + "name": "Python Web Development with Django", + "price": "29.69", + "rating": 4.0, + "authors": [5, 6, 7], + "contact": 5, + "pages": 350, + "pubdate": "2008-11-3" + } + }, + { + "pk": 5, + "model": "aggregation_regress.book", + "fields": { + "publisher": 3, + "isbn": "013790395", + "name": "Artificial Intelligence: A Modern Approach", + "price": "82.80", + "rating": 4.0, + "authors": [8, 9], + "contact": 8, + "pages": 1132, + "pubdate": "1995-1-15" + } + }, + { + "pk": 6, + "model": "aggregation_regress.book", + "fields": { + "publisher": 4, + "isbn": "155860191", + "name": "Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp", + "price": "75.00", + "rating": 5.0, + "authors": [8], + "contact": 8, + "pages": 946, + "pubdate": "1991-10-15" + } + }, + { + "pk": 1, + "model": "aggregation_regress.store", + "fields": { + "books": [1, 2, 3, 4, 5, 6], + "name": "Amazon.com", + "original_opening": "1994-4-23 9:17:42", + "friday_night_closing": "23:59:59" + } + }, + { + "pk": 2, + "model": "aggregation_regress.store", + "fields": { + "books": [1, 3, 5, 6], + "name": "Books.com", + "original_opening": "2001-3-15 11:23:37", + "friday_night_closing": "23:59:59" + } + }, + { + "pk": 3, + "model": "aggregation_regress.store", + "fields": { + "books": [3, 4, 6], + "name": "Mamma and Pappa's Books", + "original_opening": "1945-4-25 16:24:14", + "friday_night_closing": "21:30:00" + } + }, + { + "pk": 1, + "model": "aggregation_regress.author", + "fields": { + "age": 34, + "friends": [2, 4], + "name": "Adrian Holovaty" + } + }, + { + "pk": 2, + "model": "aggregation_regress.author", + "fields": { + "age": 35, + "friends": [1, 7], + "name": "Jacob Kaplan-Moss" + } + }, + { + "pk": 3, + "model": "aggregation_regress.author", + "fields": { + "age": 45, + "friends": [], + "name": "Brad Dayley" + } + }, + { + "pk": 4, + "model": "aggregation_regress.author", + "fields": { + "age": 29, + "friends": [1], + "name": "James Bennett" + } + }, + { + "pk": 5, + "model": "aggregation_regress.author", + "fields": { + "age": 37, + "friends": [6, 7], + "name": "Jeffrey Forcier" + } + }, + { + "pk": 6, + "model": "aggregation_regress.author", + "fields": { + "age": 29, + "friends": [5, 7], + "name": "Paul Bissex" + } + }, + { + "pk": 7, + "model": "aggregation_regress.author", + "fields": { + "age": 25, + "friends": [2, 5, 6], + "name": "Wesley J. Chun" + } + }, + { + "pk": 8, + "model": "aggregation_regress.author", + "fields": { + "age": 57, + "friends": [9], + "name": "Peter Norvig" + } + }, + { + "pk": 9, + "model": "aggregation_regress.author", + "fields": { + "age": 46, + "friends": [8], + "name": "Stuart Russell" + } + }, + { + "pk": 5, + "model": "aggregation_regress.hardbackbook", + "fields": { + "weight": 4.5 + } + }, + { + "pk": 6, + "model": "aggregation_regress.hardbackbook", + "fields": { + "weight": 3.7 + } + } +] diff --git a/tests/regressiontests/aggregation_regress/fixtures/initial_data.json b/tests/regressiontests/aggregation_regress/fixtures/initial_data.json deleted file mode 100644 index 597ac041f7..0000000000 --- a/tests/regressiontests/aggregation_regress/fixtures/initial_data.json +++ /dev/null @@ -1,257 +0,0 @@ -[ - { - "pk": 1, - "model": "aggregation_regress.publisher", - "fields": { - "name": "Apress", - "num_awards": 3 - } - }, - { - "pk": 2, - "model": "aggregation_regress.publisher", - "fields": { - "name": "Sams", - "num_awards": 1 - } - }, - { - "pk": 3, - "model": "aggregation_regress.publisher", - "fields": { - "name": "Prentice Hall", - "num_awards": 7 - } - }, - { - "pk": 4, - "model": "aggregation_regress.publisher", - "fields": { - "name": "Morgan Kaufmann", - "num_awards": 9 - } - }, - { - "pk": 5, - "model": "aggregation_regress.publisher", - "fields": { - "name": "Jonno's House of Books", - "num_awards": 0 - } - }, - { - "pk": 1, - "model": "aggregation_regress.book", - "fields": { - "publisher": 1, - "isbn": "159059725", - "name": "The Definitive Guide to Django: Web Development Done Right", - "price": "30.00", - "rating": 4.5, - "authors": [1, 2], - "contact": 1, - "pages": 447, - "pubdate": "2007-12-6" - } - }, - { - "pk": 2, - "model": "aggregation_regress.book", - "fields": { - "publisher": 2, - "isbn": "067232959", - "name": "Sams Teach Yourself Django in 24 Hours", - "price": "23.09", - "rating": 3.0, - "authors": [3], - "contact": 3, - "pages": 528, - "pubdate": "2008-3-3" - } - }, - { - "pk": 3, - "model": "aggregation_regress.book", - "fields": { - "publisher": 1, - "isbn": "159059996", - "name": "Practical Django Projects", - "price": "29.69", - "rating": 4.0, - "authors": [4], - "contact": 4, - "pages": 300, - "pubdate": "2008-6-23" - } - }, - { - "pk": 4, - "model": "aggregation_regress.book", - "fields": { - "publisher": 3, - "isbn": "013235613", - "name": "Python Web Development with Django", - "price": "29.69", - "rating": 4.0, - "authors": [5, 6, 7], - "contact": 5, - "pages": 350, - "pubdate": "2008-11-3" - } - }, - { - "pk": 5, - "model": "aggregation_regress.book", - "fields": { - "publisher": 3, - "isbn": "013790395", - "name": "Artificial Intelligence: A Modern Approach", - "price": "82.80", - "rating": 4.0, - "authors": [8, 9], - "contact": 8, - "pages": 1132, - "pubdate": "1995-1-15" - } - }, - { - "pk": 6, - "model": "aggregation_regress.book", - "fields": { - "publisher": 4, - "isbn": "155860191", - "name": "Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp", - "price": "75.00", - "rating": 5.0, - "authors": [8], - "contact": 8, - "pages": 946, - "pubdate": "1991-10-15" - } - }, - { - "pk": 1, - "model": "aggregation_regress.store", - "fields": { - "books": [1, 2, 3, 4, 5, 6], - "name": "Amazon.com", - "original_opening": "1994-4-23 9:17:42", - "friday_night_closing": "23:59:59" - } - }, - { - "pk": 2, - "model": "aggregation_regress.store", - "fields": { - "books": [1, 3, 5, 6], - "name": "Books.com", - "original_opening": "2001-3-15 11:23:37", - "friday_night_closing": "23:59:59" - } - }, - { - "pk": 3, - "model": "aggregation_regress.store", - "fields": { - "books": [3, 4, 6], - "name": "Mamma and Pappa's Books", - "original_opening": "1945-4-25 16:24:14", - "friday_night_closing": "21:30:00" - } - }, - { - "pk": 1, - "model": "aggregation_regress.author", - "fields": { - "age": 34, - "friends": [2, 4], - "name": "Adrian Holovaty" - } - }, - { - "pk": 2, - "model": "aggregation_regress.author", - "fields": { - "age": 35, - "friends": [1, 7], - "name": "Jacob Kaplan-Moss" - } - }, - { - "pk": 3, - "model": "aggregation_regress.author", - "fields": { - "age": 45, - "friends": [], - "name": "Brad Dayley" - } - }, - { - "pk": 4, - "model": "aggregation_regress.author", - "fields": { - "age": 29, - "friends": [1], - "name": "James Bennett" - } - }, - { - "pk": 5, - "model": "aggregation_regress.author", - "fields": { - "age": 37, - "friends": [6, 7], - "name": "Jeffrey Forcier" - } - }, - { - "pk": 6, - "model": "aggregation_regress.author", - "fields": { - "age": 29, - "friends": [5, 7], - "name": "Paul Bissex" - } - }, - { - "pk": 7, - "model": "aggregation_regress.author", - "fields": { - "age": 25, - "friends": [2, 5, 6], - "name": "Wesley J. Chun" - } - }, - { - "pk": 8, - "model": "aggregation_regress.author", - "fields": { - "age": 57, - "friends": [9], - "name": "Peter Norvig" - } - }, - { - "pk": 9, - "model": "aggregation_regress.author", - "fields": { - "age": 46, - "friends": [8], - "name": "Stuart Russell" - } - }, - { - "pk": 5, - "model": "aggregation_regress.hardbackbook", - "fields": { - "weight": 4.5 - } - }, - { - "pk": 6, - "model": "aggregation_regress.hardbackbook", - "fields": { - "weight": 3.7 - } - } -] diff --git a/tests/regressiontests/aggregation_regress/tests.py b/tests/regressiontests/aggregation_regress/tests.py index 1498f19312..36a54c0b17 100644 --- a/tests/regressiontests/aggregation_regress/tests.py +++ b/tests/regressiontests/aggregation_regress/tests.py @@ -13,6 +13,8 @@ from .models import Author, Book, Publisher, Clues, Entries, HardbackBook class AggregationTests(TestCase): + fixtures = ["aggregation_regress.json"] + def assertObjectAttrs(self, obj, **kwargs): for attr, value in kwargs.iteritems(): self.assertEqual(getattr(obj, attr), value) -- cgit v1.3