After searching and even reading the documentation on app engine unit testing am still unable to make it work on my project.
The task is simple, I have my models and request handlers in main.py.
I have installed gaetestbed and included it on my test class.
My tests class looks like this;
from main import CloudDocument # My model
class TestCloudDocument(DataStoreTestCase, unittest.TestCase):
def test_find_document(self):
self.assertEqual(CloudDocument.all().count(), 0)
When i run the above test it returns True yet my datastore has records, i would have expected this test to fail.
It seems like the test class does not see the datastore of my application. How can i make it
see and access my local datastore?
Gath
Unit tests run in an isolated environment, with their own local datastore. Only the records you add in your test or in your
setUpfunction will be present.