Skip to content

Commit 059b833

Browse files
update testcase for azure-mgmt-automation (#34620)
* update-testcase * fix-testcase
1 parent f165796 commit 059b833

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

sdk/automation/azure-mgmt-automation/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "python",
44
"TagPrefix": "python/automation/azure-mgmt-automation",
5-
"Tag": "python/automation/azure-mgmt-automation_9a9eb30418"
5+
"Tag": "python/automation/azure-mgmt-automation_e43b5b4269"
66
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from azure.mgmt.automation import AutomationClient
2+
from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
3+
4+
AZURE_LOCATION = "eastus"
5+
6+
class TestMgmtRunbook(AzureMgmtRecordedTestCase):
7+
def setup_method(self, method):
8+
self.mgmt_client = self.create_mgmt_client(AutomationClient)
9+
10+
def create_automation_account(self, group_name, location, account_name):
11+
automation_account_creation = self.mgmt_client.automation_account.create_or_update(
12+
group_name, account_name, {"location": location, "name": account_name, "properties": {"sku": {"name": "Free"}}}
13+
)
14+
return automation_account_creation.name
15+
16+
def create_runbook(self, group_name, location, account_name, runbook_name):
17+
runbook_creation = self.mgmt_client.runbook.create_or_update(
18+
group_name, account_name, runbook_name, {"location": location, "name": runbook_name, "properties": {"publishContentLink": {"uri": "https://github.com/Azure/azure-quickstart-templates/blob/master/quickstarts/microsoft.automation/101-automation/scripts/AzureAutomationTutorial.ps1"},"runbookType": "PowerShell"}}
19+
)
20+
return runbook_creation.name
21+
22+
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
23+
@recorded_by_proxy
24+
def test_get_runbook_content(self, resource_group):
25+
ACCOUNT_NAME = self.get_resource_name("automationtest07")
26+
RUNBOOK_NAME = self.get_resource_name("runbooktest07")
27+
28+
account_name = self.create_automation_account(resource_group.name, AZURE_LOCATION, ACCOUNT_NAME)
29+
runbook_name = self.create_runbook(resource_group.name, AZURE_LOCATION, account_name, RUNBOOK_NAME)
30+
31+
result = self.mgmt_client.runbook.get_content(resource_group.name, account_name, runbook_name)

0 commit comments

Comments
 (0)