コード例 #1
0
ファイル: test_apps.py プロジェクト: neveralso/cuckoo
def test_clean_keepdirs(p):
    set_cwd(tempfile.mkdtemp())
    cuckoo_create()

    with open(cwd("log", "cuckoo.log"), "wb") as f:
        f.write("this is a log file")

    os.mkdir(cwd(analysis=1))
    with open(cwd("analysis.log", analysis=1), "wb") as f:
        f.write("this is also a log file")

    with open(cwd("storage", "binaries", "a"*40), "wb") as f:
        f.write("this is a binary file")

    assert os.path.isdir(cwd("log"))
    assert os.path.exists(cwd("log", "cuckoo.log"))
    assert os.path.exists(cwd("storage", "analyses"))
    assert os.path.exists(cwd("storage", "analyses", "1"))
    assert os.path.exists(cwd("storage", "analyses", "1", "analysis.log"))
    assert os.path.exists(cwd("storage", "baseline"))
    assert os.path.exists(cwd("storage", "binaries"))
    assert os.path.exists(cwd("storage", "binaries", "a"*40))

    cuckoo_clean()

    assert os.path.isdir(cwd("log"))
    assert not os.path.exists(cwd("log", "cuckoo.log"))
    assert os.path.exists(cwd("storage", "analyses"))
    assert not os.path.exists(cwd("storage", "analyses", "1"))
    assert not os.path.exists(cwd("storage", "analyses", "1", "analysis.log"))
    assert os.path.exists(cwd("storage", "baseline"))
    assert os.path.exists(cwd("storage", "binaries"))
    assert not os.path.exists(cwd("storage", "binaries", "a"*40))
コード例 #2
0
ファイル: test_apps.py プロジェクト: neveralso/cuckoo
def test_clean_dropdb(p):
    set_cwd(tempfile.mkdtemp())
    cuckoo_create()

    cuckoo_clean()
    p.return_value.connect.assert_called_once()
    p.return_value.drop.assert_called_once_with()
コード例 #3
0
ファイル: test_apps.py プロジェクト: neveralso/cuckoo
def test_clean_dropmongo(p, q):
    set_cwd(tempfile.mkdtemp())
    cuckoo_create(cfg={
        "reporting": {
            "mongodb": {
                "enabled": True,
                "host": "host",
                "port": 13337,
            },
        },
    })

    cuckoo_clean()
    p.MongoClient.assert_called_once_with("host", 13337)
    p.MongoClient.return_value.drop_database.assert_called_once_with("cuckoo")
コード例 #4
0
ファイル: test_apps.py プロジェクト: jgajek/cuckoo
def test_clean_dropmongo(p, q):
    set_cwd(tempfile.mkdtemp())
    cuckoo_create(cfg={
        "reporting": {
            "mongodb": {
                "enabled": True,
                "host": "host",
                "port": 13337,
            },
        },
    })

    cuckoo_clean()
    p.init.assert_called_once_with()
    p.connect.assert_called_once_with()
    p.drop.assert_called_once_with()
    p.close.assert_called_once_with()
コード例 #5
0
def test_clean_dropmongo(p, q):
    set_cwd(tempfile.mkdtemp())
    cuckoo_create(cfg={
        "reporting": {
            "mongodb": {
                "enabled": True,
                "host": "host",
                "port": 13337,
            },
        },
    })

    cuckoo_clean()
    p.init.assert_called_once_with()
    p.connect.assert_called_once_with()
    p.drop.assert_called_once_with()
    p.close.assert_called_once_with()