How to use _create_archive method in tempest

Best Python code snippet using tempest_python

test_export.py

Source:test_export.py Github

copy

Full Screen

...263 export._create_archive = mocker.MagicMock(return_value="mock_archive_path")264 export._export_archive = mocker.MagicMock(return_value="SOMETHING_OTHER_THAN_USB_CONNECTED")265 with pytest.raises(ExportError):266 export._run_usb_test("mock_archive_dir")267def test__create_archive(mocker):268 """269 Ensure _create_archive creates an archive in the supplied directory.270 """271 export = Export()272 archive_path = None273 with TemporaryDirectory() as temp_dir:274 archive_path = export._create_archive(temp_dir, "mock.sd-export", {})275 assert archive_path == os.path.join(temp_dir, "mock.sd-export")276 assert os.path.exists(archive_path) # sanity check277 assert not os.path.exists(archive_path)278def test__create_archive_with_an_export_file(mocker):279 export = Export()280 archive_path = None281 with TemporaryDirectory() as temp_dir, NamedTemporaryFile() as export_file:282 archive_path = export._create_archive(temp_dir, "mock.sd-export", {}, [export_file.name])283 assert archive_path == os.path.join(temp_dir, "mock.sd-export")284 assert os.path.exists(archive_path) # sanity check285 assert not os.path.exists(archive_path)286def test__create_archive_with_multiple_export_files(mocker):287 """288 Ensure an archive289 """290 export = Export()291 archive_path = None292 with TemporaryDirectory() as temp_dir, NamedTemporaryFile() as export_file_one, NamedTemporaryFile() as export_file_two: # noqa293 archive_path = export._create_archive(294 temp_dir, "mock.sd-export", {}, [export_file_one.name, export_file_two.name]295 )296 assert archive_path == os.path.join(temp_dir, "mock.sd-export")297 assert os.path.exists(archive_path) # sanity check298 assert not os.path.exists(archive_path)299def test__export_archive(mocker):300 """301 Ensure the subprocess call returns the expected output.302 """303 mocker.patch("subprocess.check_output", return_value=b"mock")304 export = Export()305 status = export._export_archive("mock.sd-export")306 assert status == "mock"307def test__export_archive_does_not_raise_ExportError_when_CalledProcessError(mocker):...

Full Screen

Full Screen

csar.py

Source:csar.py Github

copy

Full Screen

...14# limitations under the License.15import os16from aria.cli import csar17from ..helpers import get_resource_uri18def _create_archive(tmpdir, mocker):19 service_template_dir = get_resource_uri(os.path.join(20 'service-templates', 'tosca-simple-1.0', 'node-cellar', 'node-cellar.yaml'))21 csar_path = str(tmpdir.join('csar_archive.csar'))22 csar.write(service_template_dir, csar_path, mocker.MagicMock())23 return csar_path24def test_create_csar(tmpdir, mocker):25 csar_path = _create_archive(tmpdir, mocker)26 assert os.path.exists(csar_path)27def test_read_csar(tmpdir, mocker):28 csar_path = _create_archive(tmpdir, mocker)29 csar_reader = csar.read(csar_path)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful