Exemplo n.º 1
0
 def createPayload(self, config):
     # use this to test different blacklist/whitelist/devmode/groupfunc
     # return the payload from the custom config
     return PayloadBuilder(
         config.BLACKLIST,
         config.WHITELIST,
         config.IS_DEVELOPMENT_MODE,
         config.GROUPING_FUNCTION,
     )
Exemplo n.º 2
0
def test_redaction_with_denylist():
    denylist_result = PayloadBuilder(
        denylist=denylist,
        allowlist=None,
        development_mode=True,
        grouping_function=None,
        logger=logger,
    )._redact_dict(mapping)
    assert denylist_result == expected_denylist_result
Exemplo n.º 3
0
def test_redaction_with_both():
    # when both allowlist and denylist are present, denylist takes precedence
    denylist_result = PayloadBuilder(
        denylist=denylist,
        allowlist=None,
        development_mode=True,
        grouping_function=None,
        logger=logger,
    )._redact_dict(mapping)
    assert denylist_result == expected_denylist_result
Exemplo n.º 4
0
    def __init__(self, config: MetricsApiConfig):
        """
        Constructs and initializes the ReadMe Metrics controller class with the
        specified configuration.

        Args:
            config (MetricsApiConfig): Running configuration
        """

        self.config = config
        self.payload_builder = PayloadBuilder(
            config.BLACKLIST,
            config.WHITELIST,
            config.IS_DEVELOPMENT_MODE,
            config.GROUPING_FUNCTION,
        )
        self.queue = queue.Queue()
Exemplo n.º 5
0
    def __init__(self, config: MetricsApiConfig):
        """
        Constructs and initializes the ReadMe Metrics controller class with the
        specified configuration.

        Args:
            config (MetricsApiConfig): Running configuration
        """

        self.config = config
        self.payload_builder = PayloadBuilder(
            config.DENYLIST,
            config.ALLOWLIST,
            config.IS_DEVELOPMENT_MODE,
            config.GROUPING_FUNCTION,
            config.LOGGER,
        )
        self.queue = queue.Queue()

        atexit.register(self.exit_handler)