How to use test_create_backup method in tempest

Best Python code snippet using tempest_python

backup_sample_test.py

Source: backup_sample_test.py Github

copy

Full Screen

...57 db = spanner_instance.database(DATABASE_ID)58 db.create()59 yield db60 db.drop()61def test_create_backup(capsys, database):62 version_time = None63 with database.snapshot() as snapshot:64 results = snapshot.execute_sql("SELECT CURRENT_TIMESTAMP()")65 version_time = list(results)[0][0]66 backup_sample.create_backup(INSTANCE_ID, DATABASE_ID, BACKUP_ID, version_time)67 out, _ = capsys.readouterr()68 assert BACKUP_ID in out69def test_create_backup_with_encryption_key(capsys, spanner_instance, database):70 kms_key_name = "projects/​{}/​locations/​{}/​keyRings/​{}/​cryptoKeys/​{}".format(71 spanner_instance._client.project, "us-central1", "spanner-test-keyring", "spanner-test-cmek"72 )73 backup_sample.create_backup_with_encryption_key(INSTANCE_ID, DATABASE_ID, CMEK_BACKUP_ID, kms_key_name)74 out, _ = capsys.readouterr()75 assert CMEK_BACKUP_ID in out...

Full Screen

Full Screen

test_create_backup.py

Source: test_create_backup.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2# License AGPL-3.0 or later (https:/​/​www.gnu.org/​licenses/​agpl).3# Stdlib:4import configparser5import os6import tempfile7# Thirdparty:8from click.testing import CliRunner9from mock import patch10from odoo_backup_db_cli.cli import DEFAULT_ENVIRONMENT, importlib, main11from odoo_backup_db_cli.utils import CodeError12@patch.object(importlib, 'import_module')13@patch('odoo_backup_db_cli.cli.dump_filestore')14@patch('odoo_backup_db_cli.cli.dump_db')15def test_ok(dump_db_mock, dump_filestore_mock, import_module_mock):16 runner = CliRunner()17 path = '{0}/​test_create_backup/​test_ok.conf'.format(tempfile.gettempdir())18 config = configparser.ConfigParser()19 config['common'] = {}20 config['test'] = {21 'db_host': '0.0.0.0',22 'db_port': '5434',23 'db_username': 'odoo2',24 'db_password': '1234',25 'type': 'local',26 'host': '0.1.2.3',27 'port': '5435',28 'pasv': 'True',29 'username': 'kek',30 'password': 'lol',31 'private_key': '~/​.ssh/​id_rsa',32 'backup_location': '/​tmp/​test',33 'clean_backup_after': '12',34 'db_name': 'test',35 'with_filestore': 'True',36 'filestore_location': '/​tmp/​test',37 }38 os.makedirs(os.path.dirname(path), exist_ok=True)39 with open(path, 'w') as configfile:40 config.write(configfile)41 res = runner.invoke(main, ('create-backup', 'test', '--path', path), None, None, False)42 dump_db_mock.assert_called_once()43 dump_filestore_mock.assert_called_once()44 import_module_mock.assert_called_once()45 os.remove(path)46 try:47 os.rmdir(os.path.dirname(path))48 except OSError:49 pass50 assert res.exit_code == CodeError.SUCCESS51def test_check_exist_config():52 runner = CliRunner()53 path = '{0}/​test_create_backup/​test_check_exist_config.conf'.format(tempfile.gettempdir())54 res = runner.invoke(main, ('create-backup', 'test', '--path', path))55 assert res.exit_code == CodeError.FILE_DOES_NOT_EXIST56def test_error_found():57 runner = CliRunner()58 path = '{0}/​test_create_backup/​test_error_found.conf'.format(tempfile.gettempdir())59 config = configparser.ConfigParser()60 config[DEFAULT_ENVIRONMENT] = {61 'db_host': 'localhost',62 'db_port': '5432',63 'db_username': 'odoo',64 'db_password': 'odoo',65 }66 os.makedirs(os.path.dirname(path), exist_ok=True)67 with open(path, 'w') as configfile:68 config.write(configfile)69 res = runner.invoke(main, ('create-backup', 'test', '--path', path), catch_exceptions=True)70 os.remove(path)71 try:72 os.rmdir(os.path.dirname(path))73 except OSError:74 pass...

Full Screen

Full Screen

test_fetch.py

Source: test_fetch.py Github

copy

Full Screen

...17from cloudmesh.configuration.Config import Config18from shutil import copyfile19@pytest.mark.incremental20class TestConfig:21 def test_create_backup(self):22 path = Path("~/​.cloudmesh/​pytest-test.yaml")23 config = Config()24 config.fetch(destination=path)...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Unveiling Samsung Galaxy Z Fold4 For Mobile App Testing

Hey LambdaTesters! We’ve got something special for you this week. ????

How To Use Playwright For Web Scraping with Python

In today’s data-driven world, the ability to access and analyze large amounts of data can give researchers, businesses & organizations a competitive edge. One of the most important & free sources of this data is the Internet, which can be accessed and mined through web scraping.

Six Agile Team Behaviors to Consider

Are members of agile teams different from members of other teams? Both yes and no. Yes, because some of the behaviors we observe in agile teams are more distinct than in non-agile teams. And no, because we are talking about individuals!

Nov’22 Updates: Live With Automation Testing On OTT Streaming Devices, Test On Samsung Galaxy Z Fold4, Galaxy Z Flip4, & More

Hola Testers! Hope you all had a great Thanksgiving weekend! To make this time more memorable, we at LambdaTest have something to offer you as a token of appreciation.

How To Create Custom Menus with CSS Select

When it comes to UI components, there are two versatile methods that we can use to build it for your website: either we can use prebuilt components from a well-known library or framework, or we can develop our UI components from scratch.

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