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