diff options
Diffstat (limited to 'mediagoblin/tests/tools.py')
-rw-r--r-- | mediagoblin/tests/tools.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/mediagoblin/tests/tools.py b/mediagoblin/tests/tools.py index d3369831..0e923aee 100644 --- a/mediagoblin/tests/tools.py +++ b/mediagoblin/tests/tools.py @@ -78,7 +78,7 @@ class TestingMeddleware(BaseMeddleware): def process_response(self, request, response): # All following tests should be for html only! - if response.content_type != "text/html": + if getattr(response, 'content_type', None) != "text/html": # Get out early return @@ -184,20 +184,20 @@ def assert_db_meets_expected(db, expected): """ Assert a database contains the things we expect it to. - Objects are found via '_id', so you should make sure your document - has an _id. + Objects are found via 'id', so you should make sure your document + has an id. Args: - db: pymongo or mongokit database connection - expected: the data we expect. Formatted like: {'collection_name': [ - {'_id': 'foo', + {'id': 'foo', 'some_field': 'some_value'},]} """ for collection_name, collection_data in expected.iteritems(): collection = db[collection_name] for expected_document in collection_data: - document = collection.find_one({'_id': expected_document['_id']}) + document = collection.find_one({'id': expected_document['id']}) assert document is not None # make sure it exists assert document == expected_document # make sure it matches |