def test_initial_from_config_with_endpoints(self):
     initial = RapidSmsForm.initial_from_config({
         'allowed_endpoints': ['default', 'extra']
     })
     self.assertEqual(initial, {
         'allowed_endpoints': u'default,extra',
     })
 def test_to_config(self):
     form = RapidSmsForm({
         'rapidsms_url': 'http://www.example.com/',
         'rapidsms_username': '******',
         'rapidsms_password': '******',
         'rapidsms_auth_method': 'basic',
         'rapidsms_http_method': 'POST',
         'allowed_endpoints': 'default, extra',
     })
     form.is_valid()
     self.assertEqual(form.errors, {})
     self.assertEqual(form.to_config(), {
         'rapidsms_url': u'http://www.example.com/',
         'rapidsms_username': u'rapid-user',
         'rapidsms_password': u'rapid-pass',
         'rapidsms_auth_method': u'basic',
         'rapidsms_http_method': u'POST',
         'allowed_endpoints': ['default', 'extra'],
     })
예제 #3
0
 def test_to_config(self):
     form = RapidSmsForm({
         'rapidsms_url': 'http://www.example.com/',
         'rapidsms_username': '******',
         'rapidsms_password': '******',
         'rapidsms_auth_method': 'basic',
         'rapidsms_http_method': 'POST',
         'allowed_endpoints': 'default, extra',
     })
     form.is_valid()
     self.assertEqual(form.errors, {})
     self.assertEqual(
         form.to_config(), {
             'rapidsms_url': u'http://www.example.com/',
             'rapidsms_username': u'rapid-user',
             'rapidsms_password': u'rapid-pass',
             'rapidsms_auth_method': u'basic',
             'rapidsms_http_method': u'POST',
             'allowed_endpoints': ['default', 'extra'],
         })
 def test_initial_from_config(self):
     initial = RapidSmsForm.initial_from_config({
         "rapidsms_url": "http://www.example.com/",
         "rapidsms_username": "******",
         "rapidsms_password": "******",
         "rapidsms_auth_method": "basic",
         "rapidsms_http_method": "POST",
     })
     self.assertEqual(initial, {
         'rapidsms_url': 'http://www.example.com/',
         'rapidsms_username': '******',
         'rapidsms_password': '******',
         'rapidsms_auth_method': 'basic',
         'rapidsms_http_method': 'POST',
         'allowed_endpoints': u'default',
     })
예제 #5
0
 def test_initial_from_config(self):
     initial = RapidSmsForm.initial_from_config({
         "rapidsms_url":
         "http://www.example.com/",
         "rapidsms_username":
         "******",
         "rapidsms_password":
         "******",
         "rapidsms_auth_method":
         "basic",
         "rapidsms_http_method":
         "POST",
     })
     self.assertEqual(
         initial, {
             'rapidsms_url': 'http://www.example.com/',
             'rapidsms_username': '******',
             'rapidsms_password': '******',
             'rapidsms_auth_method': 'basic',
             'rapidsms_http_method': 'POST',
             'allowed_endpoints': u'default',
         })
예제 #6
0
 def test_initial_from_config_with_endpoints(self):
     initial = RapidSmsForm.initial_from_config(
         {'allowed_endpoints': ['default', 'extra']})
     self.assertEqual(initial, {
         'allowed_endpoints': u'default,extra',
     })