def test_returns_an_object_malicious(self, malicious_data): result = MAPPER.load(malicious_data, "customer_satisfaction_action") assert isinstance(result, CustomerSatisfactionAction) assert result.message == "<script>void();</script>Are you satisfied ?" choice1, choice2 = result.choices assert choice1.kind == "positive" assert choice1.label == "<script>void();</script>yes"
def test_returns_an_object(self, data): result = MAPPER.load(data, "webhook_interlocutor") assert isinstance(result, Interlocutor) assert result.id == "123" assert result.location.lat == 1 assert result.location.long == 2 assert result.email == "*****@*****.**" assert result.first_name == "tintin" assert result.last_name is None assert result.custom_attributes == {"age": "21"} assert result.phone_number == "0645592034"
def test_returns_an_object(self, data): result = MAPPER.load(data, "customer_satisfaction_action") assert isinstance(result, CustomerSatisfactionAction) assert result.message == "Are you satisfied ?" assert len(result.choices) == 3 choice1, choice2, choice3 = result.choices assert choice1.kind == "positive" assert choice1.target.step_id == "a1" * 12 assert choice1.matching_intent_id == "b1" * 12 assert choice1.label == "yes" assert choice2.kind == "neutral" assert choice2.target.step_id == "a2" * 12 assert choice2.matching_intent_id == "c2" * 12 assert choice2.label == "neutral" assert choice3.kind == "negative" assert choice3.target.step_id == "a2" * 12 assert choice3.matching_intent_id == "b2" * 12 assert choice3.label == "no"
def test_returns_an_object(self, malicious_data): result = MAPPER.load(malicious_data, "incoming_message") assert result.text == "<script>void();</script>hello"
def test_returns_an_object(self, data): result = MAPPER.load(data, "incoming_message") assert isinstance(result, Message) assert result.text == "hello" assert isinstance(result.attachments[0], Video)
def test_returns_an_object(self, data): result = MAPPER.load(data, "custom_event") assert isinstance(result, CustomEvent) assert result.name == "event1"
def test_returns_an_object(self, data): result = MAPPER.load(data, "audio") assert isinstance(result, Audio) assert result.url == "http://example.com/"
def test_returns_an_object_malicious(self, malicious_data): result = MAPPER.load(malicious_data, "webhook_interlocutor") assert isinstance(result, Interlocutor) assert result.email == "*****@*****.**" assert result.first_name == "<script>void();</script>tintin"
def test_returns_an_object(self, data): result = MAPPER.load(data, "customer_satisfaction_callback_action") assert isinstance(result, CustomerSatisfactionCallbackAction) assert result.kind == "positive" assert isinstance(result.target, StepTarget) assert result.target.step_id == "a1" * 12
def test_returns_an_object(self, data): result = MAPPER.load(data, "url_loaded_event") assert isinstance(result, URLLoadedEvent) assert result.url == "http://example.com/"