diff options
author | Victor Shyba <victor.shyba@gmail.com> | 2015-09-18 17:31:37 -0300 |
---|---|---|
committer | Victor Shyba <victor.shyba@gmail.com> | 2015-09-28 16:52:53 -0300 |
commit | 7b1591e3d561aa6525318235e702eebeb6708560 (patch) | |
tree | d87382c6df919b25d040fd697a0b1a80496f41f5 /common/src/leap/soledad | |
parent | a660f60b9644836b0dbdf54cd04b15f4d4654d0f (diff) |
[tests] tests for ensure_security
As the other tests does. Make sure that a fresh database gets proper
security doc after calling ensure_security method.
Diffstat (limited to 'common/src/leap/soledad')
-rw-r--r-- | common/src/leap/soledad/common/tests/test_couch.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/common/src/leap/soledad/common/tests/test_couch.py b/common/src/leap/soledad/common/tests/test_couch.py index a56cea21..3622bb56 100644 --- a/common/src/leap/soledad/common/tests/test_couch.py +++ b/common/src/leap/soledad/common/tests/test_couch.py @@ -1501,6 +1501,20 @@ class CouchDatabaseExceptionsTests(CouchDBTestCase): self.create_db(ensure=True, dbname=self.db._dbname) self.db._get_transaction_log() + def test_ensure_security_doc(self): + """ + Ensure_security creates a _security ddoc to ensure that only soledad + will have member access to a db. + """ + self.create_db(ensure=False) + self.assertFalse(self.db._database.security) + self.db.ensure_security() + security_ddoc = self.db._database.security + self.assertIn('admins', security_ddoc) + self.assertFalse(security_ddoc['admins']['names']) + self.assertIn('members', security_ddoc) + self.assertIn('soledad', security_ddoc['members']['names']) + class DatabaseNameValidationTest(unittest.TestCase): |