From f7d73f29a2747952327a5c2c1c892490b7f8b6ed Mon Sep 17 00:00:00 2001 From: Daeun Yim Date: Wed, 23 Jun 2021 19:20:24 -0700 Subject: [PATCH] style fix --- .../rdbms/flexible_server_custom_common.py | 4 +- .../rdbms/flexible_server_custom_postgres.py | 4 +- .../test_rdbms_flexible_commands_mysql.py | 51 ---------------- .../test_rdbms_flexible_commands_postgres.py | 60 ------------------- 4 files changed, 4 insertions(+), 115 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/rdbms/flexible_server_custom_common.py b/src/azure-cli/azure/cli/command_modules/rdbms/flexible_server_custom_common.py index 30815a4b46b..681c2f6ddc9 100644 --- a/src/azure-cli/azure/cli/command_modules/rdbms/flexible_server_custom_common.py +++ b/src/azure-cli/azure/cli/command_modules/rdbms/flexible_server_custom_common.py @@ -205,8 +205,8 @@ def database_delete_func(client, resource_group_name=None, server_name=None, dat "If your parameter persistence is turned OFF, consider passing them explicitly.") if not yes: user_confirmation( - "Are you sure you want to delete the database '{0}' of server name '{1}'".format(database_name, - server_name), yes=yes) + "Are you sure you want to delete the database '{0}' of server '{1}'".format(database_name, + server_name), yes=yes) try: result = client.begin_delete(resource_group_name, server_name, database_name) diff --git a/src/azure-cli/azure/cli/command_modules/rdbms/flexible_server_custom_postgres.py b/src/azure-cli/azure/cli/command_modules/rdbms/flexible_server_custom_postgres.py index 4afcf1a7cac..1874eeee76f 100644 --- a/src/azure-cli/azure/cli/command_modules/rdbms/flexible_server_custom_postgres.py +++ b/src/azure-cli/azure/cli/command_modules/rdbms/flexible_server_custom_postgres.py @@ -173,7 +173,7 @@ def flexible_server_restore(cmd, client, id_parts = parse_resource_id(source_server_id) source_server_object = client.get(id_parts['resource_group'], id_parts['name']) parameters.location = source_server_object.location - + if source_server_object.public_network_access == 'Disabled': setup_restore_network(cmd=cmd, resource_group_name=resource_group_name, @@ -211,7 +211,7 @@ def setup_restore_network(cmd, resource_group_name, server_name, location, param else: for delgtn in subnet.delegations: if delgtn.service_name != DELEGATION_SERVICE_NAME: - raise CLIError("Can not use subnet with existing delegations other than {}".format(DELEGATION_SERVICE_NAME)) + raise CLIError("Can not use subnet with existing delegations other than {}".format(DELEGATION_SERVICE_NAME)) parameters.delegated_subnet_arguments = postgresql_flexibleservers.models.ServerPropertiesDelegatedSubnetArguments(subnet_arm_resource_id=subnet_id) else: raise ResourceNotFoundError("The subnet does not exist. Please verify the subnet Id.") diff --git a/src/azure-cli/azure/cli/command_modules/rdbms/tests/latest/test_rdbms_flexible_commands_mysql.py b/src/azure-cli/azure/cli/command_modules/rdbms/tests/latest/test_rdbms_flexible_commands_mysql.py index 7c5829b7609..c97ccc27288 100644 --- a/src/azure-cli/azure/cli/command_modules/rdbms/tests/latest/test_rdbms_flexible_commands_mysql.py +++ b/src/azure-cli/azure/cli/command_modules/rdbms/tests/latest/test_rdbms_flexible_commands_mysql.py @@ -176,57 +176,6 @@ def test_mysql_flexible_server_iops_delete(self): self.cmd('az group delete --name {} --yes --no-wait'.format(self.resource_group)) -class MySqlFlexibleServerVnetServerMgmtScenarioTest(FlexibleServerVnetServerMgmtScenarioTest): - - def __init__(self, method_name): - super(MySqlFlexibleServerVnetServerMgmtScenarioTest, self).__init__(method_name) - self.location = mysql_location - self.resource_group = self.create_random_name(RG_NAME_PREFIX, RG_NAME_MAX_LENGTH) - self.server = self.create_random_name(SERVER_NAME_PREFIX, SERVER_NAME_MAX_LENGTH) - self.server_2 = self.create_random_name(SERVER_NAME_PREFIX + '2', SERVER_NAME_MAX_LENGTH) - self.restore_server = 'restore-' + self.server[:55] - self.restore_server_2 = 'restore-' + self.server_2[:55] - - @pytest.mark.order(1) - def test_mysql_flexible_server_vnet_server_prepare(self): - self.cmd('az group create --location {} --name {}'.format(mysql_location, self.resource_group)) - - @AllowLargeResponse() - @pytest.mark.order(2) - def test_mysql_flexible_server_vnet_server_create(self): - self._test_flexible_server_vnet_server_create('mysql', self.resource_group, self.server) - - @AllowLargeResponse() - @pytest.mark.order(3) - def test_mysql_flexible_server_vnet_server_update_scale_up(self): - self._test_flexible_server_vnet_server_update_scale_up('mysql', self.resource_group, self.server) - - @AllowLargeResponse() - @pytest.mark.order(4) - def test_mysql_flexible_server_vnet_server_restore(self): - self._test_flexible_server_vnet_server_restore('mysql', self.resource_group, self.server, self.restore_server) - - @AllowLargeResponse() - @pytest.mark.order(5) - def test_mysql_flexible_server_vnet_ha_server_create(self): - self._test_flexible_server_vnet_ha_server_create('mysql', self.resource_group, self.server_2) - - @AllowLargeResponse() - @pytest.mark.order(6) - def test_mysql_flexible_server_vnet_ha_server_update_scale_up(self): - self._test_flexible_server_vnet_server_update_scale_up('mysql', self.resource_group, self.server_2) - - @AllowLargeResponse() - @pytest.mark.order(7) - def test_mysql_flexible_server_vnet_ha_server_delete(self): - self._test_flexible_server_vnet_server_delete('mysql', self.resource_group, self.server_2) - - @AllowLargeResponse() - @pytest.mark.order(8) - def test_mysql_flexible_server_vnet_server_delete(self): - self._test_flexible_server_vnet_server_delete('mysql', self.resource_group, self.server, self.restore_server) - - class MySqlFlexibleServerProxyResourceMgmtScenarioTest(FlexibleServerProxyResourceMgmtScenarioTest): mysql_location = mysql_location diff --git a/src/azure-cli/azure/cli/command_modules/rdbms/tests/latest/test_rdbms_flexible_commands_postgres.py b/src/azure-cli/azure/cli/command_modules/rdbms/tests/latest/test_rdbms_flexible_commands_postgres.py index ce441a408dc..2fc85923095 100644 --- a/src/azure-cli/azure/cli/command_modules/rdbms/tests/latest/test_rdbms_flexible_commands_postgres.py +++ b/src/azure-cli/azure/cli/command_modules/rdbms/tests/latest/test_rdbms_flexible_commands_postgres.py @@ -214,66 +214,6 @@ def test_postgres_flexible_server_high_availability_delete(self): self._test_flexible_server_high_availability_delete(self.resource_group) -class PostgresFlexibleServerVnetServerMgmtScenarioTest(FlexibleServerVnetServerMgmtScenarioTest): - - def __init__(self, method_name): - super(PostgresFlexibleServerVnetServerMgmtScenarioTest, self).__init__(method_name) - self.location = postgres_location - self.resource_group = self.create_random_name(RG_NAME_PREFIX, RG_NAME_MAX_LENGTH) - self.server = self.create_random_name(SERVER_NAME_PREFIX, SERVER_NAME_MAX_LENGTH) - self.server_2 = self.create_random_name(SERVER_NAME_PREFIX + '2', SERVER_NAME_MAX_LENGTH) - self.restore_server = 'restore-' + self.server[:55] - self.restore_server_2 = 'restore-' + self.server_2[:55] - - @pytest.mark.order(1) - def test_postgres_flexible_server_vnet_server_prepare(self): - self.cmd('az group create --location {} --name {}'.format(postgres_location, self.resource_group)) - - @AllowLargeResponse() - @pytest.mark.order(2) - def test_postgres_flexible_server_vnet_server_create(self): - self._test_flexible_server_vnet_server_create('postgres', self.resource_group, self.server) - - @AllowLargeResponse() - @pytest.mark.order(3) - def test_postgres_flexible_server_vnet_server_update_scale_up(self): - self._test_flexible_server_vnet_server_update_scale_up('postgres', self.resource_group, self.server) - - @AllowLargeResponse() - @pytest.mark.order(4) - def test_postgres_flexible_server_vnet_server_restore(self): - self._test_flexible_server_vnet_server_restore('postgres', self.resource_group, self.server, self.restore_server) - - @AllowLargeResponse() - @pytest.mark.order(5) - def test_postgres_flexible_server_vnet_server_delete(self): - self._test_flexible_server_vnet_server_delete('postgres', self.resource_group, self.server, self.restore_server) - - @AllowLargeResponse() - @pytest.mark.order(6) - def test_postgres_flexible_server_vnet_ha_server_create(self): - self._test_flexible_server_vnet_ha_server_create('postgres', self.resource_group, self.server_2) - - @AllowLargeResponse() - @pytest.mark.order(7) - def test_postgres_flexible_server_vnet_ha_server_update_scale_up(self): - self._test_flexible_server_vnet_server_update_scale_up('postgres', self.resource_group, self.server_2) - - @AllowLargeResponse() - @pytest.mark.order(8) - def test_postgres_flexible_server_vnet_ha_server_restore(self): - self._test_flexible_server_vnet_server_restore('postgres', self.resource_group, self.server_2, self.restore_server_2) - - @AllowLargeResponse() - @pytest.mark.order(9) - def test_postgres_flexible_server_vnet_ha_server_delete(self): - self._test_flexible_server_vnet_server_delete('postgres', self.resource_group, self.server_2, self.restore_server_2) - - @pytest.mark.order(10) - def test_postgres_flexible_server_vnet_server_mgmt_delete(self): - self._test_flexible_server_vnet_server_mgmt_delete(self.resource_group) - - class PostgresFlexibleServerProxyResourceMgmtScenarioTest(FlexibleServerProxyResourceMgmtScenarioTest): postgres_location = postgres_location