add tests to increase code coverage

This commit is contained in:
Erdenezul Batmunkh
2017-09-10 01:37:17 +09:00
parent 5bdd35464b
commit 70088704e2
3 changed files with 19 additions and 1 deletions

View File

@@ -429,6 +429,10 @@ class GeoQueriesTest(MongoDBTestCase):
roads = Road.objects.filter(line__geo_within=polygon).count()
self.assertEqual(1, roads)
sphere = [[-1, 42,], 2]
roads = Road.objects.filter(line__geo_within_sphere=sphere).count()
self.assertEqual(0, roads)
roads = Road.objects.filter(line__geo_within={"$geometry": polygon}).count()
self.assertEqual(1, roads)

View File

@@ -1882,6 +1882,12 @@ class QuerySetTest(unittest.TestCase):
post.reload()
self.assertTrue('mongo' in post.tags)
# Push with arrays
BlogPost.objects.update(push__tags=['python', 'scala'])
post.reload()
self.assertTrue('python' in post.tags)
self.assertTrue('scala' in post.tags)
BlogPost.objects.update_one(push_all__tags=['db', 'nosql'])
post.reload()
self.assertTrue('db' in post.tags and 'nosql' in post.tags)