diff options
author | Jay Doane <jaydoane@apache.org> | 2020-02-21 22:46:50 -0800 |
---|---|---|
committer | Jay Doane <jaydoane@apache.org> | 2020-03-03 15:32:00 -0800 |
commit | 8687b625ae9d2089b2385566d1f69276a3cb5743 (patch) | |
tree | e6827cf543f05c8f4671045b417f79393d48c412 | |
parent | 02f415ca2215df62f8db6d103a3659fb770c7192 (diff) | |
download | couchdb-8687b625ae9d2089b2385566d1f69276a3cb5743.tar.gz |
Clean up mango test user docs
Tests based on class `UsersDbTests` don't clean up the user docs it
puts in the `_users` db. This uses the classmethod `tearDownClass` to
delete those docs.
(cherry picked from commit 3d559eb14fd709662d3eb5cda8afe9a45687c3b1)
-rw-r--r-- | src/mango/test/mango.py | 4 | ||||
-rw-r--r-- | src/mango/test/user_docs.py | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/mango/test/mango.py b/src/mango/test/mango.py index 1212b732f..e78160f57 100644 --- a/src/mango/test/mango.py +++ b/src/mango/test/mango.py @@ -299,6 +299,10 @@ class UsersDbTests(unittest.TestCase): klass.db = Database("_users") user_docs.setup_users(klass.db) + @classmethod + def tearDownClass(klass): + user_docs.teardown_users(klass.db) + def setUp(self): self.db = self.__class__.db diff --git a/src/mango/test/user_docs.py b/src/mango/test/user_docs.py index 8f0ed2e04..316ca7841 100644 --- a/src/mango/test/user_docs.py +++ b/src/mango/test/user_docs.py @@ -59,6 +59,10 @@ def setup_users(db, **kwargs): db.save_docs(copy.deepcopy(USERS_DOCS)) +def teardown_users(db): + [db.delete_doc(doc['_id']) for doc in USERS_DOCS] + + def setup(db, index_type="view", **kwargs): db.recreate() db.save_docs(copy.deepcopy(DOCS)) |