1078 cursor = self.pool['system'] |
1078 cursor = self.pool['system'] |
1079 cursor.execute("SELECT %supassword from %sCWUser WHERE %slogin='bob'" |
1079 cursor.execute("SELECT %supassword from %sCWUser WHERE %slogin='bob'" |
1080 % (SQL_PREFIX, SQL_PREFIX, SQL_PREFIX)) |
1080 % (SQL_PREFIX, SQL_PREFIX, SQL_PREFIX)) |
1081 passwd = str(cursor.fetchone()[0]) |
1081 passwd = str(cursor.fetchone()[0]) |
1082 self.assertEquals(passwd, crypt_password('toto', passwd[:2])) |
1082 self.assertEquals(passwd, crypt_password('toto', passwd[:2])) |
1083 rset = self.execute("Any X WHERE X is CWUser, X login 'bob', X upassword '%s'" % passwd) |
1083 rset = self.execute("Any X WHERE X is CWUser, X login 'bob', X upassword %(pwd)s", |
|
1084 {'pwd': Binary(passwd)}) |
1084 self.assertEquals(len(rset.rows), 1) |
1085 self.assertEquals(len(rset.rows), 1) |
1085 self.assertEquals(rset.description, [('CWUser',)]) |
1086 self.assertEquals(rset.description, [('CWUser',)]) |
1086 |
1087 |
1087 def test_update_upassword(self): |
1088 def test_update_upassword(self): |
1088 cursor = self.pool['system'] |
1089 cursor = self.pool['system'] |
1092 {'pwd': 'tutu'}) |
1093 {'pwd': 'tutu'}) |
1093 cursor.execute("SELECT %supassword from %sCWUser WHERE %slogin='bob'" |
1094 cursor.execute("SELECT %supassword from %sCWUser WHERE %slogin='bob'" |
1094 % (SQL_PREFIX, SQL_PREFIX, SQL_PREFIX)) |
1095 % (SQL_PREFIX, SQL_PREFIX, SQL_PREFIX)) |
1095 passwd = str(cursor.fetchone()[0]) |
1096 passwd = str(cursor.fetchone()[0]) |
1096 self.assertEquals(passwd, crypt_password('tutu', passwd[:2])) |
1097 self.assertEquals(passwd, crypt_password('tutu', passwd[:2])) |
1097 rset = self.execute("Any X WHERE X is CWUser, X login 'bob', X upassword '%s'" % passwd) |
1098 rset = self.execute("Any X WHERE X is CWUser, X login 'bob', X upassword %(pwd)s", |
|
1099 {'pwd': Binary(passwd)}) |
1098 self.assertEquals(len(rset.rows), 1) |
1100 self.assertEquals(len(rset.rows), 1) |
1099 self.assertEquals(rset.description, [('CWUser',)]) |
1101 self.assertEquals(rset.description, [('CWUser',)]) |
1100 |
1102 |
1101 # non regression tests #################################################### |
1103 # non regression tests #################################################### |
1102 |
1104 |