Ejemplo n.º 1
0
    def test_debug(self):
        set_cwd(tempfile.mkdtemp())

        db.connect(dsn="sqlite:///:memory:")
        db.add_url("http://google.com/")
        db.add_error("foo", 1)
        db.add_error("bar", 1)
        db.add_error("bar", 1)

        d = Debug()
        d.task = Dictionary({
            "id": 1,
        })
        # Note that the according exception doesn't show up provided we didn't
        # configure the DatabaseHandler logging handler with our temporary
        # database here.
        d.log_path = "nothing_to_see_here"
        d.cuckoolog_path = "neither here"
        d.mitmerr_path = "no no no"

        results = d.run()
        assert len(list(results["errors"])) == len(results["errors"])
        assert len(results["errors"]) == 3
        assert results["errors"][:2] == ["foo", "bar"]
        assert results["action"] == ["vmrouting"]

        db.add_error("err", 1, "thisisanaction")
        results = d.run()
        assert results["action"] == ["vmrouting", "thisisanaction"]
Ejemplo n.º 2
0
    def test_debug(self):
        set_cwd(tempfile.mkdtemp())

        db.connect(dsn="sqlite:///:memory:")
        db.add_url("http://google.com/")
        db.add_error("foo", 1)
        db.add_error("bar", 1)
        db.add_error("bar", 1)

        d = Debug()
        d.task = Dictionary({
            "id": 1,
        })
        # Note that the according exception doesn't show up provided we didn't
        # configure the DatabaseHandler logging handler with our temporary
        # database here.
        d.log_path = "nothing_to_see_here"
        d.cuckoolog_path = "neither here"
        d.mitmerr_path = "no no no"

        results = d.run()
        assert len(list(results["errors"])) == len(results["errors"])
        assert len(results["errors"]) == 3
        assert results["errors"][:2] == ["foo", "bar"]
        assert results["action"] == ["vmrouting"]

        db.add_error("err", 1, "thisisanaction")
        results = d.run()
        assert results["action"] == ["vmrouting", "thisisanaction"]