Exemplo n.º 1
0
 def test_valid_form_get(self):
     """Form should be valid if POST keys match configuration."""
     data = {'phone': '1112223333', 'message': 'hi there'}
     form = GenericHttpForm(data,
                            backend_name='http-backend',
                            identity_name='phone',
                            text_name='message')
     self.assertTrue(form.is_valid(), form.errors)
Exemplo n.º 2
0
 def test_get_incoming_data(self):
     """get_incoming_data should return matching text and connection."""
     data = {'identity': '1112223333', 'text': 'hi there'}
     form = GenericHttpForm(data, backend_name='http-backend')
     form.is_valid()
     incoming_data = form.get_incoming_data()
     self.assertEqual(data['text'], incoming_data['text'])
     self.assertEqual(data['identity'],
                      incoming_data['connection'].identity)
     self.assertEqual('http-backend',
                      incoming_data['connection'].backend.name)
Exemplo n.º 3
0
 def test_invalid_form_post(self):
     """Form is invalid if POST keys don't match configuration."""
     data = {'invalid-phone': '1112223333', 'invalid-message': 'hi there'}
     form = GenericHttpForm(data, backend_name='http-backend')
     self.assertFalse(form.is_valid())
Exemplo n.º 4
0
 def test_valid_form_get(self):
     """Form should be valid if POST keys match configuration."""
     data = {'phone': '1112223333', 'message': 'hi there'}
     form = GenericHttpForm(data, backend_name='http-backend',
                            identity_name='phone', text_name='message')
     self.assertTrue(form.is_valid(), form.errors)
Exemplo n.º 5
0
 def test_valid_default_post(self):
     """Form should be valid if POST keys match default configuration."""
     data = {'identity': '1112223333', 'text': 'hi there'}
     form = GenericHttpForm(data, backend_name='http-backend')
     self.assertTrue(form.is_valid(), form.errors)