Change unit tests to use add_table_field

One of the test migrations adds a field. So rewrite it to
use the new add_table_field helper function.  This is a
good test for it.
This commit is contained in:
Elrond 2011-10-22 00:21:25 +02:00
parent 03d47730cd
commit 733dc2c275

View File

@ -23,6 +23,7 @@ from mediagoblin.tests.tools import (
from mediagoblin.db.util import ( from mediagoblin.db.util import (
RegisterMigration, MigrationManager, ObjectId, RegisterMigration, MigrationManager, ObjectId,
MissingCurrentMigration) MissingCurrentMigration)
from mediagoblin.db.migrations import add_table_field
# This one will get filled with local migrations # This one will get filled with local migrations
TEST_MIGRATION_REGISTRY = {} TEST_MIGRATION_REGISTRY = {}
@ -45,10 +46,7 @@ def creature_add_magical_powers(database):
magical powers, all existing monsters, setting to an empty list is magical powers, all existing monsters, setting to an empty list is
fine. fine.
""" """
database['creatures'].update( add_table_field(database, 'creatures', 'magical_powers', [])
{'magical_powers': {'$exists': False}},
{'$set': {'magical_powers': []}},
multi=True)
@RegisterMigration(2, TEST_MIGRATION_REGISTRY) @RegisterMigration(2, TEST_MIGRATION_REGISTRY)