From 65a2f8a68b1bbe49818fe9cd8eecd4968ff19ba7 Mon Sep 17 00:00:00 2001 From: Ross Lawley Date: Tue, 29 May 2012 17:06:03 +0100 Subject: [PATCH] Updated configs --- setup.cfg | 3 +- tests/test_bugfix.py | 47 +++++++++++++++++++ tests/{connection.py => test_connection.py} | 0 tests/{dereference.py => test_dereference.py} | 0 tests/{django_tests.py => test_django.py} | 0 tests/{document.py => test_document.py} | 0 ...c_document.py => test_dynamic_document.py} | 0 tests/{fields.py => test_fields.py} | 0 tests/{queryset.py => test_queryset.py} | 0 ...ction.py => test_replicaset_connection.py} | 0 tests/{signals.py => test_signals.py} | 0 11 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 tests/test_bugfix.py rename tests/{connection.py => test_connection.py} (100%) rename tests/{dereference.py => test_dereference.py} (100%) rename tests/{django_tests.py => test_django.py} (100%) rename tests/{document.py => test_document.py} (100%) rename tests/{dynamic_document.py => test_dynamic_document.py} (100%) rename tests/{fields.py => test_fields.py} (100%) rename tests/{queryset.py => test_queryset.py} (100%) rename tests/{replicaset_connection.py => test_replicaset_connection.py} (100%) rename tests/{signals.py => test_signals.py} (100%) diff --git a/setup.cfg b/setup.cfg index 23453407..619c9457 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,5 +11,4 @@ with-coverage = 1 #cover-html-dir = ../htmlcov cover-package = mongoengine cover-erase = 1 -where = tests -tests = bugfix, connection, dereference, django_tests, document, dynamic_document, fields, queryset, replicaset_connection, signals \ No newline at end of file +where = tests \ No newline at end of file diff --git a/tests/test_bugfix.py b/tests/test_bugfix.py new file mode 100644 index 00000000..f0ea1856 --- /dev/null +++ b/tests/test_bugfix.py @@ -0,0 +1,47 @@ +# import pickle +# import pymongo +# import bson +# import warnings + +# from datetime import datetime + +# import tempfile +# import pymongo, gridfs + +import unittest +from mongoengine import * +from bson.objectid import ObjectId + +class BugFixTest(unittest.TestCase): + + + def setUp(self): + + conn = connect(db='mongoenginetest') + + def test_items_list(self): + + class ActivityType1(EmbeddedDocument): + activity_id = IntField() + activity_name = StringField() + + class ActivityType2(EmbeddedDocument): + activity_id = IntField() + activity_status = StringField() + + class UserActivities(Document): + user_id = IntField() + activity = GenericEmbeddedDocumentField(choices=(ActivityType1, ActivityType2)) + + + UserActivities.drop_collection() + + user_id = 123 + activity_id = 321 + UserActivities(user_id=user_id, activity=ActivityType2(activity_id=activity_id, activity_status="A")).save() + + self.assertEquals(1, UserActivities.objects(user_id=user_id, __raw__={'activity.activity_status': 'A'}).count()) + + + + diff --git a/tests/connection.py b/tests/test_connection.py similarity index 100% rename from tests/connection.py rename to tests/test_connection.py diff --git a/tests/dereference.py b/tests/test_dereference.py similarity index 100% rename from tests/dereference.py rename to tests/test_dereference.py diff --git a/tests/django_tests.py b/tests/test_django.py similarity index 100% rename from tests/django_tests.py rename to tests/test_django.py diff --git a/tests/document.py b/tests/test_document.py similarity index 100% rename from tests/document.py rename to tests/test_document.py diff --git a/tests/dynamic_document.py b/tests/test_dynamic_document.py similarity index 100% rename from tests/dynamic_document.py rename to tests/test_dynamic_document.py diff --git a/tests/fields.py b/tests/test_fields.py similarity index 100% rename from tests/fields.py rename to tests/test_fields.py diff --git a/tests/queryset.py b/tests/test_queryset.py similarity index 100% rename from tests/queryset.py rename to tests/test_queryset.py diff --git a/tests/replicaset_connection.py b/tests/test_replicaset_connection.py similarity index 100% rename from tests/replicaset_connection.py rename to tests/test_replicaset_connection.py diff --git a/tests/signals.py b/tests/test_signals.py similarity index 100% rename from tests/signals.py rename to tests/test_signals.py