Ejemplo n.º 1
0
 def test_get_one_file_in_too_many(self):
     from check_manifest import get_one_file_in, Failure
     with mock.patch('os.listdir', lambda dir: ['b', 'a']):
         with self.assertRaises(Failure) as cm:
             get_one_file_in('/some/dir')
         self.assertEqual(str(cm.exception),
                          "More than one file exists in /some/dir:\na\nb")
Ejemplo n.º 2
0
 def test_get_one_file_in_empty_directory(self):
     from check_manifest import get_one_file_in, Failure
     with mock.patch('os.listdir', lambda dir: []):
         with self.assertRaises(Failure) as cm:
             get_one_file_in('/some/dir')
         self.assertEqual(str(cm.exception),
                          "No files found in /some/dir")
Ejemplo n.º 3
0
 def test_get_one_file_in_too_many(self):
     from check_manifest import get_one_file_in, Failure
     with mock.patch('os.listdir', lambda dir: ['b', 'a']):
         with self.assertRaises(Failure) as cm:
             get_one_file_in('/some/dir')
         self.assertEqual(str(cm.exception),
                          "More than one file exists in /some/dir:\na\nb")
Ejemplo n.º 4
0
 def test_get_one_file_in_empty_directory(self):
     from check_manifest import get_one_file_in, Failure
     with mock.patch('os.listdir', lambda dir: []):
         with self.assertRaises(Failure) as cm:
             get_one_file_in('/some/dir')
         self.assertEqual(str(cm.exception),
                          "No files found in /some/dir")
Ejemplo n.º 5
0
 def test_get_one_file_in(self):
     from check_manifest import get_one_file_in
     with mock.patch('os.listdir', lambda dir: ['a']):
         self.assertEqual(get_one_file_in(os.path.normpath('/some/dir')),
                          os.path.normpath('/some/dir/a'))
Ejemplo n.º 6
0
 def test_get_one_file_in(self):
     from check_manifest import get_one_file_in
     with mock.patch('os.listdir', lambda dir: ['a']):
         self.assertEqual(get_one_file_in(os.path.normpath('/some/dir')),
                          os.path.normpath('/some/dir/a'))