Exemplo n.º 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})
Exemplo n.º 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()
Exemplo n.º 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()
Exemplo n.º 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()
Exemplo n.º 5
0
 def test_non_existing_import(self):
     with self.assertRaises(ImportError):
         SETTINGS.check()
Exemplo n.º 6
0
 def test_ok(self):
     """Test ok setting."""
     SETTINGS.check()
     self.assertEqual(SETTINGS.processors, {'dummy': DummyPaymentProcessor})
Exemplo n.º 7
0
 def test_ok(self):
     SETTINGS.check()
Exemplo n.º 8
0
 def test_not_a_string(self):
     with self.assertRaisesMessage(ImproperlyConfigured, 'CALLBACKS must be a list of dotted paths to callables'):
         SETTINGS.check()
Exemplo n.º 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()
Exemplo n.º 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()
Exemplo n.º 11
0
 def test_wrong_keys(self):
     """Test dictionary with wrong keys."""
     expected = "Invalid keys."
     with self.assertRaisesRegex(ImproperlyConfigured, expected):
         SETTINGS.check()
Exemplo n.º 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()
Exemplo n.º 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()