Example #1
0
 def test_text_protocol_has_data(self):
     protocol = Protocol()
     protocol.payload(text="Test data")
     json_version = protocol.to_json()
     decoded = json.loads(json_version)
     self.assertIn('text', decoded['data'])
     self.assertEquals(decoded['data']['text'], "Test data")
Example #2
0
 def test_text_protocol_message(self):
     protocol = Protocol()
     protocol.payload(text="Test data")
     json_version = protocol.to_json()
     decoded = json.loads(json_version)
     self.assertEquals(decoded['message'], None)
     protocol.payload(message="welcome screen")
     json_version = protocol.to_json()
     decoded = json.loads(json_version)
     self.assertEquals(decoded['message'], "welcome screen")
     self.assertEquals(decoded['data']['text'], "Test data")