sqlitestore_test.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:aws-sg-mngr 作者: mkazin 项目源码 文件源码
def test_init():

    # Delete existing DB to init from a clean state
    if os.path.exists(MOCK_DB_FILE):
        os.remove(MOCK_DB_FILE)

    db = SqliteStore(MockConfig())
    assert db
    # Only the Global CIDR should appear here
    assert len(db.query_all()) == 1

    # Forcibly destroy DB object to close connection
    gc.disable()
    del db
    gc.enable()

    # Test the existing DB
    db = SqliteStore(MockConfig())
    # Again, only the Global CIDR should appear
    assert len(db.query_all()) == 1

    # Cleanup
    os.remove(MOCK_DB_FILE)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号