def test_two_enrichments_correctness_independent_of_force_reverse(bools):
    pub_values = {1: 2, "a": "b"}
    page_values = {1: 5, "a": "3", "what": "who"}
    valid = Validation("low", Priority.LOW)
    pub = publisher.Publisher(priority_threshold=Priority.CRITICAL)
    page = pagerduty.PagerDutyPublisher("url", "token")
    valid.enrich(page, page_values, force_namespace=bools)
    valid.enrich(pub, pub_values, force_namespace=bools)
    pub_data = valid.get_enriched(pub)
    page_data = valid.get_enriched(page)
    for item in pub_values.items():
        assert item in pub_data.items()
    for item in page_values.items():
        assert item in page_data.items()
def test_two_enrichments_correctness_independent_of_force_reverse(bools):
    pub_values = {1: 2, "a": "b"}
    page_values = {1: 5, "a": "3", "what": "who"}
    valid = Validation("low", Priority.LOW)
    pub = publisher.Publisher(priority_threshold=Priority.CRITICAL)
    page = pagerduty.PagerDutyPublisher("url", "token")
    valid.enrich(page, page_values, force_namespace=bools)
    valid.enrich(pub, pub_values, force_namespace=bools)
    pub_data = valid.get_enriched(pub)
    page_data = valid.get_enriched(page)
    for item in pub_values.items():
        assert item in pub_data.items()
    for item in page_values.items():
        assert item in page_data.items()
def test_empty_enrichment_case():
    values = {}
    valid = Validation("low", Priority.LOW)
    pub = publisher.Publisher(priority_threshold=Priority.CRITICAL)
    valid.enrich(pub, values)
    data = valid.get_enriched(pub)
    assert data == values
def test_simple_enrichment_forced_namespace():
    values = {1: 2, "a": "b"}
    valid = Validation("low", Priority.LOW)
    pub = publisher.Publisher(priority_threshold=Priority.CRITICAL)
    valid.enrich(pub, values, force_namespace=True)
    data = valid.get_enriched(pub)
    assert data == values
def test_get_wrong_enrichment_forced_namespace():
    pub_values = {1: 2, "a": "b"}
    valid = Validation("low", Priority.LOW)
    pub = publisher.Publisher(priority_threshold=Priority.CRITICAL)
    page = pagerduty.PagerDutyPublisher("url", "token")
    valid.enrich(pub, pub_values, force_namespace=True)
    assert valid.get_enriched(page) == {}
def test_simple_enrichment_forced_namespace():
    values = {1: 2, "a": "b"}
    valid = Validation("low", Priority.LOW)
    pub = publisher.Publisher(priority_threshold=Priority.CRITICAL)
    valid.enrich(pub, values, force_namespace=True)
    data = valid.get_enriched(pub)
    assert data == values
def test_get_wrong_enrichment_forced_namespace():
    pub_values = {1: 2, "a": "b"}
    valid = Validation("low", Priority.LOW)
    pub = publisher.Publisher(priority_threshold=Priority.CRITICAL)
    page = pagerduty.PagerDutyPublisher("url", "token")
    valid.enrich(pub, pub_values, force_namespace=True)
    assert valid.get_enriched(page) == {}
def test_empty_enrichment_case():
    values = {}
    valid = Validation("low", Priority.LOW)
    pub = publisher.Publisher(priority_threshold=Priority.CRITICAL)
    valid.enrich(pub, values)
    data = valid.get_enriched(pub)
    assert data == values
def test_get_empty_enrichment():
    valid = Validation("low", Priority.LOW)
    pub = publisher.Publisher(priority_threshold=Priority.CRITICAL)
    assert valid.get_enriched(pub) == {}
示例#10
0
def test_get_empty_enrichment():
    valid = Validation("low", Priority.LOW)
    pub = publisher.Publisher(priority_threshold=Priority.CRITICAL)
    assert valid.get_enriched(pub) == {}