# HG changeset patch # User Pierre-Yves David # Date 1358431897 -3600 # Node ID 8fbb2f65721ed4ccf38d27f9a6646aa4e63ae349 # Parent 67a5fccb802ab937cd9ebd28439a2ef55d5b4797 [test] precheck initial condition diff -r 67a5fccb802a -r 8fbb2f65721e server/test/unittest_security.py --- a/server/test/unittest_security.py Wed Jan 16 17:42:16 2013 +0100 +++ b/server/test/unittest_security.py Thu Jan 17 15:11:37 2013 +0100 @@ -606,6 +606,16 @@ {'ti': trinfo.eid}) def test_emailaddress_security(self): + # check for prexisting email adresse + if self.execute('Any X WHERE X is EmailAddress'): + rset = self.execute('Any X, U WHERE X is EmailAddress, U use_email X') + msg = ['Preexisting email readable by anon found!'] + tmpl = ' - "%s" used by user "%s"' + for i in xrange(len(rset)): + email, user = rset.get_entity(i, 0), rset.get_entity(i, 1) + msg.append(tmpl % (email.dc_title(), user.dc_title())) + raise RuntimeError('\n'.join(msg)) + # actual test self.execute('INSERT EmailAddress X: X address "hop"').get_entity(0, 0) self.execute('INSERT EmailAddress X: X address "anon", U use_email X WHERE U login "anon"').get_entity(0, 0) self.commit()