django-nonrel/djangoappengine — pull request #40 by dragonx (2012-10-04 20:00:56+00:00)
Title: Add helper classes for testing

GAETestCase is a TestCase base class where the developer can set the consistency_policy. The class will then set the HRD consistency policy when running each test in the TestCase.

Usage:

class MyTestClass(GAETestCase):
consistency_probabiltiy = 0 # float value between 0 and 1
fixtures = ['myfixture1']
def test_function(self):
pass:

LiveServerTestCase runs dev_appserver in a separate thread for each test in the test case. This allows you to run Selenium tests against the live server. Fixtures are properly supported. However, the developer needs to be very careful to syncrhonize the testing code against the dev_appserver request handlers using the provided lock.

Usage:

from selenium import webdrver
class MyTestClass(LiveServerTestCase):
def test_function(self):
webdriver.POST(self.live_server_url + '/path_to_create_new_entity')
self.lock.acqure()
MyModel.objects.get(id='new entity id')
self.lock.release()