File size: 620 Bytes
2b73c16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import pytest

from support_ticket_env import parse_action


def test_parse_action_accepts_valid_discriminated_union() -> None:
    action = parse_action({"action_type": "search_kb", "query": "password reset"})
    assert action.action_type == "search_kb"
    assert action.query == "password reset"


def test_parse_action_rejects_invalid_refund_reason_code() -> None:
    with pytest.raises(Exception):
        parse_action(
            {
                "action_type": "issue_refund",
                "amount_cents": 4900,
                "reason_code": "manual_override",
            }
        )