Esempio n. 1
0
def test_create_valid_tx():
	q1 = "insert into tx (date, account, name, amount, antitransaction) \
				  values ('2015-01-01', 110, 'valid tx', 100, 1)"
	q2 = "select name from tx where account = 110 and amount = 100"
	c.execute(q1)
	c.execute(q2)
	assert_equal(c.fetchone(), ("valid tx", ))
Esempio n. 2
0
def test_create_valid_tx():
    q1 = "insert into tx (date, account, name, amount, antitransaction) \
				  values ('2015-01-01', 110, 'valid tx', 100, 1)"

    q2 = "select name from tx where account = 110 and amount = 100"
    c.execute(q1)
    c.execute(q2)
    assert_equal(c.fetchone(), ("valid tx", ))
Esempio n. 3
0
def test_tx_autoincrement():
	# This is kind of a weak test, maybe get rid of it?
	q1 = "select max(rowid) from tx"
	q2 = "insert into tx (account, amount) values (100, 100)"
	q3 = "select last_insert_rowid() from tx"

	max_rowid = c.execute(q1).fetchone()[0]
	c.execute(q2)
	c.execute(q3)
	assert_greater(c.fetchone()[0], max_rowid)
Esempio n. 4
0
def test_tx_autoincrement():
    # This is kind of a weak test, maybe get rid of it?
    q1 = "select max(rowid) from tx"
    q2 = "insert into tx (account, amount) values (100, 100)"
    q3 = "select last_insert_rowid() from tx"

    max_rowid = c.execute(q1).fetchone()[0]
    c.execute(q2)
    c.execute(q3)
    assert_greater(c.fetchone()[0], max_rowid)
Esempio n. 5
0
def test_create_valid_account_code():
	q1 = "insert into account_codes (code, name) values (101, \"a valid account\")"
	q2 = "select * from account_codes where code = 101"
	c.execute(q1)
	c.execute(q2)
	assert_equal(c.fetchone(), (101, "a valid account"))
Esempio n. 6
0
def test_create_valid_account_code():
    q1 = "insert into account_codes (code, name) values (101, \"a valid account\")"
    q2 = "select * from account_codes where code = 101"
    c.execute(q1)
    c.execute(q2)
    assert_equal(c.fetchone(), (101, "a valid account"))