示例#1
0
 def test_get_incoming_data(self):
     """get_incoming_data should return matching text and connection."""
     form = VumiForm(self.valid_data, backend_name='vumi-backend')
     form.is_valid()
     incoming_data = form.get_incoming_data()
     self.assertEqual(self.valid_data['content'], incoming_data['text'])
     self.assertEqual(self.valid_data['from_addr'],
                      incoming_data['connection'].identity)
     self.assertEqual('vumi-backend',
                      incoming_data['connection'].backend.name)
示例#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 = VumiForm(data, backend_name='vumi-backend')
     self.assertFalse(form.is_valid())
示例#3
0
 def test_valid_form(self):
     """Form should be valid if GET keys match configuration."""
     form = VumiForm(self.valid_data, backend_name='vumi-backend')
     self.assertTrue(form.is_valid())