def test_get_submission_dirs_filetransfer_is_none(self): params = D3RParameters() try: fac = ExternalDataSubmissionFactory('/foo', params) fac._get_submission_dirs('ha') self.fail('Expected AttributeError') except AttributeError: pass
def test_get_submission_dirs_list_is_none(self): params = D3RParameters() mockft = D3RParameters() mockft.list_dirs = Mock(return_value=None) fac = ExternalDataSubmissionFactory('/foo', params) fac.set_file_transfer(mockft) self.assertEqual(len(fac._get_submission_dirs('ha')), 0) mockft.list_dirs.assert_called_with('ha')
def test_get_submission_dirs_one_dir(self): params = D3RParameters() mockft = D3RParameters() mockft.list_dirs = Mock(return_value=['somedir']) fac = ExternalDataSubmissionFactory('/foo', params) fac.set_file_transfer(mockft) dlist = fac._get_submission_dirs('ha') self.assertEqual(dlist[0], 'somedir') mockft.list_dirs.assert_called_with('ha')