Exemplo n.º 1
0
 def test_path_values_with_check(self):
     value = PathValue()
     with env(DJANGO_TEST='/'):
         self.assertEqual(value.setup('TEST'), '/')
     with env(DJANGO_TEST='~/'):
         self.assertEqual(value.setup('TEST'), os.path.expanduser('~'))
     with env(DJANGO_TEST='/does/not/exist'):
         self.assertRaises(ValueError, value.setup, 'TEST')
Exemplo n.º 2
0
 def test_path_values_with_check(self):
     value = PathValue()
     with env(DJANGO_TEST='/'):
         self.assertEqual(value.setup('TEST'), '/')
     with env(DJANGO_TEST='~/'):
         self.assertEqual(value.setup('TEST'), os.path.expanduser('~'))
     with env(DJANGO_TEST='/does/not/exist'):
         self.assertRaises(ValueError, value.setup, 'TEST')
Exemplo n.º 3
0
 def test_path_values_no_check(self):
     value = PathValue(check_exists=False)
     with env(DJANGO_TEST="/"):
         self.assertEqual(value.setup("TEST"), "/")
     with env(DJANGO_TEST="~/spam/eggs"):
         self.assertEqual(value.setup("TEST"), os.path.join(os.path.expanduser("~"), "spam", "eggs"))
     with env(DJANGO_TEST="/does/not/exist"):
         self.assertEqual(value.setup("TEST"), "/does/not/exist")
Exemplo n.º 4
0
 def test_path_values_with_check(self):
     value = PathValue()
     with env(DJANGO_TEST="/"):
         self.assertEqual(value.setup("TEST"), "/")
     with env(DJANGO_TEST="~/"):
         self.assertEqual(value.setup("TEST"), os.path.expanduser("~"))
     with env(DJANGO_TEST="/does/not/exist"):
         self.assertRaises(ValueError, value.setup, "TEST")
Exemplo n.º 5
0
 def test_path_values_no_check(self):
     value = PathValue(check_exists=False)
     with env(DJANGO_TEST='/'):
         self.assertEqual(value.setup('TEST'), '/')
     with env(DJANGO_TEST='~/spam/eggs'):
         self.assertEqual(value.setup('TEST'),
                          os.path.join(os.path.expanduser('~'),
                                       'spam', 'eggs'))
     with env(DJANGO_TEST='/does/not/exist'):
         self.assertEqual(value.setup('TEST'), '/does/not/exist')
Exemplo n.º 6
0
 def test_path_values_no_check(self):
     value = PathValue(check_exists=False)
     with env(DJANGO_TEST='/'):
         self.assertEqual(value.setup('TEST'), '/')
     with env(DJANGO_TEST='~/spam/eggs'):
         self.assertEqual(
             value.setup('TEST'),
             os.path.join(os.path.expanduser('~'), 'spam', 'eggs'))
     with env(DJANGO_TEST='/does/not/exist'):
         self.assertEqual(value.setup('TEST'), '/does/not/exist')