def test_download_ok(self, data_mock): data_mock.configure_mock(id=123, **{'resolwe': MagicMock()}) data_mock.configure_mock(**{'files.return_value': ['file1.txt', 'file2.fq.gz']}) Data.download(data_mock) data_mock.resolwe.download_files.assert_called_once_with([u'123/file1.txt', u'123/file2.fq.gz'], None) data_mock.reset_mock() Data.download(data_mock, download_dir="/some/path/") data_mock.resolwe.download_files.assert_called_once_with([u'123/file1.txt', u'123/file2.fq.gz'], '/some/path/')
def test_download_ok(self, data_mock): data_mock.configure_mock(id=123, **{'resolwe': MagicMock()}) data_mock.configure_mock( **{'files.return_value': ['file1.txt', 'file2.fq.gz']}) Data.download(data_mock) data_mock.resolwe._download_files.assert_called_once_with( [u'123/file1.txt', u'123/file2.fq.gz'], None) data_mock.reset_mock() Data.download(data_mock, download_dir="/some/path/") data_mock.resolwe._download_files.assert_called_once_with( [u'123/file1.txt', u'123/file2.fq.gz'], '/some/path/')
def test_download_ok(self, data_mock): data_mock.configure_mock(id=123, **{"resolwe": MagicMock()}) data_mock.configure_mock(**{ "files.return_value": ["file1.txt", "file2.fq.gz"], }) Data.download(data_mock) data_mock.resolwe._download_files.assert_called_once_with( ["123/file1.txt", "123/file2.fq.gz"], None) data_mock.reset_mock() Data.download(data_mock, download_dir="/some/path/") data_mock.resolwe._download_files.assert_called_once_with( ["123/file1.txt", "123/file2.fq.gz"], "/some/path/")
def test_download_fail(self, data_mock): message = "Only one of file_name or field_name may be given." with six.assertRaisesRegex(self, ValueError, message): Data.download(data_mock, file_name="a", field_name="b")
def test_download_fail(self, data_mock): message = "Only one of file_name or field_name may be given." with six.assertRaisesRegex(self, ValueError, message): Data.download(data_mock, file_name="a", field_name="b")