예제 #1
0
파일: tests.py 프로젝트: lordmauve/nucleon
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',
        })
예제 #2
0
파일: tests.py 프로젝트: lordmauve/nucleon
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'
            },
        ])
예제 #3
0
파일: tests.py 프로젝트: lordmauve/nucleon
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)
예제 #4
0
파일: tests.py 프로젝트: lordmauve/nucleon
def test_select_with_insufficient_positional_params():
    """Test that required parameters are validated."""
    select_with_params(1).rows
예제 #5
0
파일: tests.py 프로젝트: lordmauve/nucleon
def test_select_with_insufficient_keyword_params():
    """Test that required parameters are validated."""
    select_with_params(id='1').rows
예제 #6
0
파일: tests.py 프로젝트: lordmauve/nucleon
def test_select_with_keyword_and_positional_params():
    """Test that selects reject mixed positional and keyword parameters"""
    select_with_params(1, name='foo').rows
예제 #7
0
파일: tests.py 프로젝트: lordmauve/nucleon
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
예제 #8
0
파일: tests.py 프로젝트: lordmauve/nucleon
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
예제 #9
0
파일: tests.py 프로젝트: lordmauve/nucleon
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
예제 #10
0
파일: tests.py 프로젝트: lordmauve/nucleon
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)