def __init__(self, client, testing=0, scanner=None, chains=None, artifact_types=None, bid_strategy=None,
                 accept=None, exclude=None):
        self.client = client
        self.chains = chains
        self.scanner = scanner
        if artifact_types is None:
            self.valid_artifact_types = [ArtifactType.FILE]
        else:
            self.valid_artifact_types = artifact_types

        self.bounty_filter = BountyFilter(accept, exclude)

        self.client.on_run.register(self.__handle_run)
        self.client.on_new_bounty.register(self.__handle_new_bounty)
        self.client.on_reveal_assertion_due.register(self.__handle_reveal_assertion)
        self.client.on_quorum_reached.register(self.__handle_quorum_reached)
        self.client.on_settled_bounty.register(self.__handle_settled_bounty)
        self.client.on_settle_bounty_due.register(self.__handle_settle_bounty)

        self.bid_strategy = bid_strategy

        self.testing = testing
        self.bounties_pending = {}
        self.bounties_pending_locks = {}
        self.bounties_seen = 0
        self.reveals_posted = 0
        self.settles_posted = 0
async def test_excluded():
    # arrange
    bounty_filter = BountyFilter(None, [("mimetype", "text/plain")])
    # act
    allowed = bounty_filter.is_allowed({"mimetype": "text/plain"})
    # assert
    assert not allowed
async def test_not_accepted():
    # arrange
    bounty_filter = BountyFilter([("mimetype", "text/plain")], None)
    # act
    allowed = bounty_filter.is_allowed({"mimetype": "text/html"})
    # assert
    assert not allowed
async def test_scans_artifact_accepted_match_only_one():
    # arrange
    bounty_filter = BountyFilter([("mimetype", "text/plain"),
                                  ("mimetype", "text/html")], None)
    # act
    allowed = bounty_filter.is_allowed({"mimetype": "text/html"})
    # assert
    assert allowed