def test_missing_dir(self):
     self.assertEqual(save_dir('etc', 'foo'),
                      '{"proc.error": "Output \'etc\' set to a missing directory: \'foo\'."}')
     self.assertEqual(
         save_dir('etc', 'foo bar'),
         '{"proc.error": "Output \'etc\' set to a missing directory: \'foo bar\'."}'
     )
 def test_missing_dir(self):
     self.assertEqual(
         save_dir('etc', 'foo'),
         '{"proc.error": "Output \'etc\' set to a missing directory: \'foo\'."}'
     )
     self.assertEqual(
         save_dir('etc', 'foo bar'),
         '{"proc.error": "Output \'etc\' set to a missing directory: \'foo bar\'."}'
     )
 def test_missing_dir(self):
     expected = {
         'type': 'COMMAND',
         'type_data': 'process_log',
         'data': {'error': "Output 'etc' set to a missing directory: 'foo'."},
     }
     self.assertEqual(save_dir('etc', 'foo'), expected)
     expected = {
         'type': 'COMMAND',
         'type_data': 'process_log',
         'data': {'error': "Output 'etc' set to a missing directory: 'foo bar'."},
     }
     self.assertEqual(save_dir('etc', 'foo bar'), expected)
 def test_dir(self, path_mock, copy_mock, dir_size_mock):
     expected = {
         'type': 'COMMAND',
         'type_data': 'update_output',
         'data': {'etc': {'dir': 'foo', 'size': 42}},
     }
     self.assertEqual(save_dir('etc', 'foo'), expected)
     expected = {
         'type': 'COMMAND',
         'type_data': 'update_output',
         'data': {'etc': {'dir': 'foo bar', 'size': 42}},
     }
     self.assertEqual(save_dir('etc', 'foo bar'), expected)
 def test_dir_with_refs(self, isdir_mock, path_mock, copy_mock, dir_size_mock):
     expected = {
         'type': 'COMMAND',
         'type_data': 'update_output',
         'data': {
             'etc': {'dir': 'foo', 'size': 42, 'refs': ('ref1.txt', 'ref2.txt')}
         },
     }
     self.assertEqual(save_dir('etc', 'foo', 'ref1.txt', 'ref2.txt'), expected)
 def test_dir_with_missing_refs(
     self, isdir_mock, path_mock, copy_mock, dir_size_mock
 ):
     expected = {
         'type': 'COMMAND',
         'type_data': 'process_log',
         'data': {
             'error': "Output 'etc' set to missing references: 'ref1.gz, ref2.gz'."
         },
     }
     self.assertEqual(save_dir('etc', 'foo', 'ref1.gz', 'ref2.gz'), expected)
Beispiel #7
0
 def to_output(self, value):
     """Convert value to process output format."""
     return json.loads(
         resolwe_runtime_utils.save_dir(self.name, value.path, *value.refs))
 def test_dir_with_missing_refs(self, isdir_mock):
     self.assertEqual(
         save_dir('etc', 'foo', 'ref1.gz', 'ref2.gz'),
         '{"proc.error": "Output \'etc\' set to missing references: \'ref1.gz, ref2.gz\'."}'
     )
 def test_dir_with_refs(self, isdir_mock):
     self.assertJSONEqual(save_dir('etc', 'foo', 'ref1.txt', 'ref2.txt'),
                          '{"etc": {"dir": "foo", "refs": ["ref1.txt", "ref2.txt"]}}')
 def test_dir(self, isdir_mock):
     self.assertEqual(save_dir('etc', 'foo'), '{"etc": {"dir": "foo"}}')
     self.assertEqual(save_dir('etc', 'foo bar'), '{"etc": {"dir": "foo bar"}}')
 def test_dir_with_missing_refs(self, isdir_mock):
     self.assertEqual(
         save_dir('etc', 'foo', 'ref1.gz', 'ref2.gz'),
         '{"proc.error": "Output \'etc\' set to missing references: \'ref1.gz, ref2.gz\'."}'
     )
 def test_dir_with_refs(self, isdir_mock):
     self.assertJSONEqual(
         save_dir('etc', 'foo', 'ref1.txt', 'ref2.txt'),
         '{"etc": {"dir": "foo", "refs": ["ref1.txt", "ref2.txt"]}}')
 def test_dir(self, isdir_mock):
     self.assertEqual(save_dir('etc', 'foo'), '{"etc": {"dir": "foo"}}')
     self.assertEqual(save_dir('etc', 'foo bar'),
                      '{"etc": {"dir": "foo bar"}}')
Beispiel #14
0
 def to_output(self, value):
     """Convert value to process output format."""
     return json.loads(resolwe_runtime_utils.save_dir(self.name, value.path, *value.refs))