Ejemplo n.º 1
0
 def test_no_secret(self):
     test_settings = self.old_valid_settings
     del test_settings['secret']
     try:
         settings.validate(test_settings)
     except Exception as e:
         self.fail(e)
Ejemplo n.º 2
0
 def test_path_defined(self):
     test_settings = self.old_valid_settings
     test_settings['path'] = ['filepath']
     # Validate
     settings.validate(test_settings)
     self.assertEqual(test_settings.get('path'), ['filepath'])
     # Default should not affect
     settings.set_defaults(test_settings)
     self.assertEqual(test_settings.get('path'), ['filepath'])
Ejemplo n.º 3
0
 def test_cache_defined(self):
     test_settings = self.old_valid_settings
     test_settings['cache'] = {'a': 'b'}
     # Validate
     settings.validate(test_settings)
     self.assertEqual(test_settings.get('cache'), {
         'a': 'b',
         'enabled': True
     })
Ejemplo n.º 4
0
 def test_skipauth_valid(self):
     test_settings = copy.deepcopy(self.minimum_valid_settings)
     del test_settings["key"]
     del test_settings["secret"]
     test_settings["skipauth"] = True
     try:
         settings.validate(test_settings)
     except Exception as e:
         self.fail(
             """
     settings.validate raised an exception unexpectedly!
     Error: %s
     """
             % e
         )
Ejemplo n.º 5
0
 def test_path_default(self):
     # Validate
     test_settings = self.old_valid_settings
     settings.validate(test_settings)
     self.assertEqual(test_settings.get('path'), [''])
Ejemplo n.º 6
0
 def test_cache_disabled(self):
     test_settings = {'cache': {'path': 'does not exist', 'enabled': False}}
     with self.assertRaises(ValueError):
         settings.validate(test_settings)
Ejemplo n.º 7
0
 def test_cache_default(self):
     test_settings = copy.deepcopy(self.minimum_valid_settings)
     settings.validate(test_settings)
     self.assertEqual(test_settings["cache"], {})
Ejemplo n.º 8
0
 def test_path_default(self):
     test_settings = copy.deepcopy(self.minimum_valid_settings)
     settings.validate(test_settings)
     self.assertEqual(test_settings["path"], [""])
Ejemplo n.º 9
0
 def test_cache_does_not_exist(self):
     test_settings = {"cache": {"path": "does not exist"}}
     with self.assertRaises(ValueError):
         settings.validate(test_settings)
Ejemplo n.º 10
0
 def test_cache_not_expired(self):
     test_settings = {"cache": {"path": "exists", "expires": 3}}
     try:
         settings.validate(test_settings)
     except:
         self.fail("settings.validate raised an exception unexpectedly!")
Ejemplo n.º 11
0
 def test_parallel_defined(self):
     # Validate
     test_settings = self.old_valid_settings
     test_settings['parallel'] = True
     settings.validate(test_settings)
     self.assertEqual(test_settings.get('parallel'), True)
Ejemplo n.º 12
0
 def test_parallel_default(self):
     test_settings = self.old_valid_settings
     # Validate
     settings.validate(test_settings)
     self.assertEqual(test_settings.get('parallel'), False)
Ejemplo n.º 13
0
 def test_bucket_required(self):
     test_settings = self.old_valid_settings
     del test_settings['bucket']
     with self.assertRaises(ValueError):
         settings.validate(test_settings)
Ejemplo n.º 14
0
 def test_cache_disabled_type_conversion(self):
     test_settings = self.old_valid_settings
     test_settings['cache'] = {'disable': 'proddin'}
     # Validate
     settings.validate(test_settings)
     self.assertEqual(test_settings['cache']['disable'], ['proddin'])
Ejemplo n.º 15
0
 def test_cache_default(self):
     # Validate
     test_settings = self.old_valid_settings
     settings.validate(test_settings)
     self.assertEqual(test_settings.get('cache'), {})
Ejemplo n.º 16
0
 def test_parallel_true_string(self):
     test_settings = self.old_valid_settings
     test_settings['parallel'] = 'true'
     settings.validate(test_settings)
     self.assertTrue(test_settings.get('parallel'))
Ejemplo n.º 17
0
 def test_minimum_valid_settings(self):
     test_settings = copy.deepcopy(self.minimum_valid_settings)
     try:
         settings.validate(test_settings)
     except:
         self.fail("settings.validate raised an exception unexpectedly!")
Ejemplo n.º 18
0
 def test_old_valid_settings(self):
     test_settings = self.old_valid_settings
     try:
         settings.validate(test_settings)
     except:
         self.fail("settings.validate raised an exception unexpectedly!")
Ejemplo n.º 19
0
 def test_cache_expired(self):
     test_settings = {"cache": {"path": "exists", "expires": 1}}
     with self.assertRaises(ValueError):
         settings.validate(test_settings)
Ejemplo n.º 20
0
 def test_cache_not_expired(self):
     test_settings = {'cache': {'path': 'exists', 'expires': 3}}
     try:
         settings.validate(test_settings)
     except:
         self.fail("settings.validate raised an exception unexpectedly!")
Ejemplo n.º 21
0
 def test_cache_disabled(self):
     test_settings = {"cache": {"path": "does not exist", "enabled": False}}
     with self.assertRaises(ValueError):
         settings.validate(test_settings)
Ejemplo n.º 22
0
 def test_cache_expired(self):
     test_settings = {'cache': {'path': 'exists', 'expires': 1}}
     with self.assertRaises(ValueError):
         settings.validate(test_settings)
Ejemplo n.º 23
0
 def test_path_type_conversion(self):
     test_settings = copy.deepcopy(self.minimum_valid_settings)
     test_settings["path"] = "filepath"
     settings.validate(test_settings)
     self.assertEqual(test_settings["path"], ["filepath"])
Ejemplo n.º 24
0
 def test_cache_does_not_exist(self):
     test_settings = {'cache': {'path': 'does not exist'}}
     with self.assertRaises(ValueError):
         settings.validate(test_settings)
Ejemplo n.º 25
0
 def test_secret_required(self):
     test_settings = copy.deepcopy(self.minimum_valid_settings)
     del test_settings["secret"]
     with self.assertRaises(ValueError):
         settings.validate(test_settings)
Ejemplo n.º 26
0
 def test_path_type_conversion(self):
     test_settings = self.old_valid_settings
     test_settings['path'] = 'filepath'
     # Validate
     settings.validate(test_settings)
     self.assertEqual(test_settings.get('path'), ['filepath'])