예제 #1
0
 def test_ok(self):
     """Test ok setting."""
     SETTINGS.check()
     expected = {'DOWNLOADER': DummyDownloader,
                 'PARSER': DummyParser,
                 'DOWNLOADER_PARAMS': {'param_name': 'param_val'}}
     self.assertEqual(SETTINGS.downloaders, {'dummy': expected})
예제 #2
0
 def test_not_correct_subclass(self):
     """Test not subclass of AbstractPaymentProcessor."""
     with self.assertRaisesRegex(ImproperlyConfigured, '{} is not subclass of AbstractPaymentProcessor'.format(
             'django_pain.tests.test_settings.TestProcessorsSetting')):
         SETTINGS.check()
예제 #3
0
 def test_not_dict(self):
     """Test not dictionary setting."""
     with self.assertRaisesRegex(ImproperlyConfigured, 'PAIN_PROCESSORS must be {}, not {}'.format(dict, list)):
         SETTINGS.check()
예제 #4
0
 def test_not_str_key(self):
     """Test dictionary with not str keys."""
     with self.assertRaisesRegex(ImproperlyConfigured, 'All keys of PAIN_PROCESSORS must be {}'.format(str)):
         SETTINGS.check()
예제 #5
0
 def test_non_existing_import(self):
     with self.assertRaises(ImportError):
         SETTINGS.check()
예제 #6
0
 def test_ok(self):
     """Test ok setting."""
     SETTINGS.check()
     self.assertEqual(SETTINGS.processors, {'dummy': DummyPaymentProcessor})
예제 #7
0
 def test_ok(self):
     SETTINGS.check()
예제 #8
0
 def test_not_a_string(self):
     with self.assertRaisesMessage(ImproperlyConfigured, 'CALLBACKS must be a list of dotted paths to callables'):
         SETTINGS.check()
예제 #9
0
 def test_invalid_parser(self):
     """Test invalid parser."""
     expected = "django_pain.tests.test_settings.DummyDownloader is not a subclass of BankStatementParser"
     with self.assertRaisesRegex(ImproperlyConfigured, expected):
         SETTINGS.check()
예제 #10
0
 def test_invalid_subsettings(self):
     """Test invalid subsettings."""
     expected = "The key 1 is not of type str."
     with self.assertRaisesRegex(ImproperlyConfigured, expected):
         SETTINGS.check()
예제 #11
0
 def test_wrong_keys(self):
     """Test dictionary with wrong keys."""
     expected = "Invalid keys."
     with self.assertRaisesRegex(ImproperlyConfigured, expected):
         SETTINGS.check()
예제 #12
0
 def test_not_dict_value(self):
     """Test dictionary with not dict values."""
     expected = "Item dummy's value 1 is not of type dict."
     with self.assertRaisesRegex(ImproperlyConfigured, expected):
         SETTINGS.check()
예제 #13
0
 def test_not_str_key(self):
     """Test dictionary with not str keys."""
     expected = 'The key 0 is not of type str.'
     with self.assertRaisesRegex(ImproperlyConfigured, expected):
         SETTINGS.check()