def test_process_length_0(self, resolwe_mock): resolwe_mock.api = MagicMock(**{'process.get.return_value': []}) message = "Could not get process for given slug." with six.assertRaisesRegex(self, ValueError, message): Resolwe._get_process(resolwe_mock)
def test_process_length_gt1(self, resolwe_mock): process_out = ['process1', 'process2'] resolwe_mock.api = MagicMock(**{'process.get.return_value': process_out}) message = "Unexpected behaviour at get process with slug .*" with six.assertRaisesRegex(self, ValueError, message): Resolwe._get_process(resolwe_mock)
def test_get_process(self, resolwe_mock): resolwe_mock.api = MagicMock(**{'process.get.return_value': self.process_json}) process = Resolwe._get_process(resolwe_mock) self.assertEqual(process['slug'], 'some:prc:slug:')