def setUp(self): if PY3: raise SkipTest('django does not have Python 3 support') if not DJ15: raise SkipTest('mongo_auth requires Django 1.5') connect(db='mongoenginetest') User.drop_collection() super(MongoAuthTest, self).setUp()
def setUp(self): User.drop_collection() self.display = Display(visible=0, size=(800, 600)) self.display.start() self.driver = webdriver.Firefox() self.driver.implicitly_wait(30) self.base_url = "http://localhost:8000" self.verificationErrors = [] self.accept_next_alert = True
def test_nested_queryset_template_iterator(self): # Try iterating the same queryset twice, nested, in a Django template. names = ['A', 'B', 'C', 'D'] class User(Document): name = StringField() def __unicode__(self): return self.name User.drop_collection() for name in names: User(name=name).save() users = User.objects.all().order_by('name') template = Template("{% for user in users %}{{ user.name }}{% ifequal forloop.counter 2 %} {% for inner_user in users %}{{ inner_user.name }}{% endfor %} {% endifequal %}{% endfor %}") rendered = template.render(Context({'users': users})) self.assertEqual(rendered, 'AB ABCD CD')
def setUp(self): if not DJ15: raise SkipTest('mongo_auth requires Django 1.5') connect(db='mongoenginetest') User.drop_collection() super(MongoAuthTest, self).setUp()
def tearDown(self): User.drop_collection()
def tearDown(self): self.driver.quit() self.assertEqual([], self.verificationErrors) self.display.stop() Doc.objects.delete() User.drop_collection()