def test_select_unique(): """Test that it is possible to select a single row as a dict""" eq_( select_with_params(id='1', name='foo').unique, { 'id': 1, 'name': 'foo', })
def test_select_with_keyword_params(): """Test that parameters can be passed to a select.""" eq_( select_with_params(id=1, name='foo').rows, [ { 'id': 1, 'name': 'foo' }, ])
def test_update(): """We can update and receive a row count.""" res = simple_update(old='foo', new='woo') eq_( select_with_params(id='1', name='woo').unique, { 'id': 1, 'name': 'woo', }) eq_(res, 1) eq_(simple_update(old='foo', new='woo'), 0)
def test_select_with_insufficient_positional_params(): """Test that required parameters are validated.""" select_with_params(1).rows
def test_select_with_insufficient_keyword_params(): """Test that required parameters are validated.""" select_with_params(id='1').rows
def test_select_with_keyword_and_positional_params(): """Test that selects reject mixed positional and keyword parameters""" select_with_params(1, name='foo').rows
def test_simple_insert(): """Test that we can execute simple transactions.""" id = simple_insert(name='asdf5').value eq_(id, 4) assert select_with_params(id=id, name='asdf5').unique
def test_insert(): """Test that we can execute transactions.""" id = do_insert('asdf1') eq_(id, 4) assert select_with_params(id=id, name='asdf1').unique
def test_select_unique_no_results(): """Test that unique select raises an error if there are no results""" select_with_params(id='1', name='zap').unique
def test_delete(): """We can delete and receive a row count.""" res = simple_delete(name='foo') eq_(select_with_params(id='1', name='foo').rows, []) eq_(res, 1) eq_(simple_delete(name='foo'), 0)