Exemplo n.º 1
0
 def test_get_incoming_data(self):
     """get_incoming_data should return matching text and connection."""
     data = {'from_number': '1112223333', 'content': 'hi there'}
     form = TelerivetForm(data, backend_name='telerivet-backend')
     self.assertTrue(form.is_valid())
     incoming_data = form.get_incoming_data()
     self.assertEqual(data['content'], incoming_data['text'])
     self.assertEqual(data['from_number'],
                      incoming_data['connection'].identity)
     self.assertEqual('telerivet-backend',
                      incoming_data['connection'].backend.name)
Exemplo n.º 2
0
 def test_invalid_form(self):
     """Form is invalid if POST keys don't match configuration."""
     data = {'invalid-phone': '1112223333', 'invalid-message': 'hi there'}
     form = TelerivetForm(data, backend_name='telerivet-backend')
     self.assertFalse(form.is_valid())
Exemplo n.º 3
0
 def test_valid_form(self):
     """Form should be valid if GET keys match configuration."""
     data = {'from_number': '1112223333', 'content': 'hi there'}
     form = TelerivetForm(data, backend_name='telerivet-backend')
     self.assertTrue(form.is_valid())