Esempio n. 1
0
def test_outcome_is_billing(outcome: Outcome, is_billing: bool):
    """
    Tests the complete behavior of ``is_billing``, used for routing outcomes to
    different Kafka topics. This is more of a sanity check to prevent
    unintentional changes.
    """
    assert outcome.is_billing() is is_billing
Esempio n. 2
0
 def map_row(self, row: MutableMapping[str, Any]) -> None:
     if "outcome" in row:
         row["outcome"] = Outcome(row["outcome"]).api_name()
Esempio n. 3
0
 def _parse_outcome(outcome: str) -> Outcome:
     try:
         return Outcome.parse(outcome)
     except KeyError:
         raise InvalidField(f'Invalid outcome: "{outcome}"')
Esempio n. 4
0
def test_parse_outcome(name, outcome):
    """
    Asserts *case insensitive* parsing of outcomes from their canonical names,
    as used in the API and queries.
    """
    assert Outcome.parse(name) == outcome