Пример #1
0
def test_delete_nonexisting():
    mds = MockDatastore()
    try:
        mds.delete(1)
        assert False
    except KeyError:
        assert True
Пример #2
0
def test_update_nonexisting():
    mds = MockDatastore()
    mds.create(1, {})
    try:
        mds.update(2, {})
        assert False
    except KeyError:
        assert True
Пример #3
0
def test_create():
    mds = MockDatastore()
    assert(mds.create(1, {}) is True)
Пример #4
0
def test_list_3():
    mds = MockDatastore()
    mds.create(1, {})
    mds.create(2, {})
    mds.create(3, {})
    assert(len(mds.list()) == 3)
Пример #5
0
def test_list_nothing():
    mds = MockDatastore()
    assert(len(mds.list()) == 0)
Пример #6
0
def test_create_datastore():
    mds = MockDatastore()
    assert(isinstance(mds, object))
Пример #7
0
def test_delete_existing():
    mds = MockDatastore()
    mds.create(1, {})
    assert(mds.delete(1))
Пример #8
0
def test_update_existing():
    mds = MockDatastore()
    mds.create(1, {})
    mds.update(1, {})
    assert(mds.read(1) == {})
Пример #9
0
def test_read():
    mds = MockDatastore()
    mds.create(1, {})
    assert(mds.read(1) == {})