Skip to content

Commit

Permalink
- add test to prove that a user folder flag cannot be acquired elsewhere
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed Apr 14, 2019
1 parent 2df58a1 commit 86cbe76
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ For changes before version 3.0, see ``HISTORY.rst``.
4.0b7 (unreleased)
------------------

- add test to prove that a user folder flag cannot be acquired elsewhere
(`#7 <https://github.com/zopefoundation/AccessControl/issues/7>`_)

- tighten basic auth string handling in ``BasicUserFolder.identify``
(`#56 <https://github.com/zopefoundation/AccessControl/issues/56>`_)

Expand Down
18 changes: 18 additions & 0 deletions src/AccessControl/tests/test_userfolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,21 @@ def test__doAddUser_with_preencrypted_passwords(self):
self.assertEqual(user.__, ENCRYPTED)
self.assertTrue(uf._isPasswordEncrypted(user.__))
self.assertTrue(pw_validate(user.__, PASSWORD))

def test_acquisition_influences_encryption(self):
from Acquisition import Implicit

class ImplicitContainer(Implicit):
pass

uf = self._makeOne()
fake_parent = ImplicitContainer()
wrapped_uf = uf.__of__(fake_parent)

# Make sure that acquisition works for this fixture
setattr(fake_parent, 'testflag', True)
self.assertTrue(wrapped_uf.testflag)

# The real test. Can we influence the ``encrypt_passwords`` flag?
setattr(fake_parent, 'encrypt_passwords', False)
self.assertTrue(wrapped_uf.encrypt_passwords)

0 comments on commit 86cbe76

Please sign in to comment.