File: test_workspace.py

package info (click to toggle)
python-azure 20230112%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 749,544 kB
  • sloc: python: 6,815,827; javascript: 287; makefile: 195; xml: 109; sh: 105
file content (28 lines) | stat: -rw-r--r-- 923 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import pytest
import azure.mgmt.loganalytics
from devtools_testutils import AzureMgmtRecordedTestCase, recorded_by_proxy, ResourceGroupPreparer

class TestMgmtLogAnalyticsWorkspace(AzureMgmtRecordedTestCase):

    def setup_method(self, method):
        self.client = self.create_mgmt_client(
            azure.mgmt.loganalytics.LogAnalyticsManagementClient
        )

    @ResourceGroupPreparer()
    @recorded_by_proxy
    def test_loganalytics_workspace(self, resource_group, location):
        workspace_name = 'WorkspaceName'
        workspace_result = self.client.workspaces.begin_create_or_update(
            resource_group.name,
            workspace_name,
            {
                'location': location
            }
        ).result()

        workspace = self.client.workspaces.get(
            resource_group.name,
            workspace_name
        )
        assert workspace_result.name == workspace.name