TESTING
author Radek Brich <radek.brich@devl.cz>
Fri, 25 Jul 2014 15:15:16 +0200
changeset 106 db4c582a2abd
parent 104 d8ff52a0390f
permissions -rw-r--r--
Fix autocommit mode in oursql.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49
08e4dfe1b0cb Add test for MyManager (enable only when MySQLdb is available). Configure tests using pgtoolkit.conf (same as used by other executables).
Radek Brich <radek.brich@devl.cz>
parents: 22
diff changeset
     1
TESTING
08e4dfe1b0cb Add test for MyManager (enable only when MySQLdb is available). Configure tests using pgtoolkit.conf (same as used by other executables).
Radek Brich <radek.brich@devl.cz>
parents: 22
diff changeset
     2
=======
22
680631f35d83 Add test for PgManager.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     3
49
08e4dfe1b0cb Add test for MyManager (enable only when MySQLdb is available). Configure tests using pgtoolkit.conf (same as used by other executables).
Radek Brich <radek.brich@devl.cz>
parents: 22
diff changeset
     4
All test should work at least with Python 2.7 and 3.2
22
680631f35d83 Add test for PgManager.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     5
680631f35d83 Add test for PgManager.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     6
680631f35d83 Add test for PgManager.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     7
How to test
680631f35d83 Add test for PgManager.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     8
-----------
680631f35d83 Add test for PgManager.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     9
104
d8ff52a0390f Rename to pydbkit.
Radek Brich <radek.brich@devl.cz>
parents: 75
diff changeset
    10
1. copy pydbkit.conf.example to pydbkit.conf, modify it so it points to your test database
22
680631f35d83 Add test for PgManager.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    11
49
08e4dfe1b0cb Add test for MyManager (enable only when MySQLdb is available). Configure tests using pgtoolkit.conf (same as used by other executables).
Radek Brich <radek.brich@devl.cz>
parents: 22
diff changeset
    12
2. create test tables using sql/tests.sql
22
680631f35d83 Add test for PgManager.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    13
49
08e4dfe1b0cb Add test for MyManager (enable only when MySQLdb is available). Configure tests using pgtoolkit.conf (same as used by other executables).
Radek Brich <radek.brich@devl.cz>
parents: 22
diff changeset
    14
3. run tests.py
22
680631f35d83 Add test for PgManager.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    15
75
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    16
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    17
PostgreSQL
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    18
----------
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    19
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    20
CREATE ROLE test LOGIN PASSWORD 'test';
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    21
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    22
CREATE DATABASE test;
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    23
\c test
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    24
\i sql/tests.sql
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    25
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    26
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    27
MySQL
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    28
-----
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    29
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    30
CREATE USER 'test'@'%' IDENTIFIED BY 'test';
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    31
GRANT all ON test.* TO 'test'@'%';
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    32
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    33
CREATE DATABASE test;
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    34
USE test;
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    35
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    36
CREATE TABLE test
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    37
(
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    38
  id INT NOT NULL AUTO_INCREMENT,
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    39
  name TEXT,
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    40
  PRIMARY KEY (id)
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    41
)
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    42
ENGINE=InnoDB CHARSET=utf8;
39f777341db4 MyManager: Add Cursor.mogrify(). Fix query logging. Update tests.
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    43