-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_communication_scenario.py
102 lines (87 loc) · 3.55 KB
/
test_communication_scenario.py
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
import os
from azure.cli.testsdk import ScenarioTest
from azure.cli.testsdk import ResourceGroupPreparer
from azure.cli.testsdk.scenario_tests import AllowLargeResponse
from .example_steps import step_create
from .example_steps import step_show
from .example_steps import step_list
from .example_steps import step_list2
from .example_steps import step_update
from .example_steps import step_link_notification_hub
from .example_steps import step_list_key
from .example_steps import step_regenerate_key
from .example_steps import step_delete
from .recording_processors import BodyReplacerProcessor
from .. import (
try_manual,
raise_if,
calc_coverage
)
TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..'))
# Env setup_scenario
@try_manual
def setup_scenario(test, rg_2, rg):
pass
# Env cleanup_scenario
@try_manual
def cleanup_scenario(test, rg_2, rg):
pass
# Testcase: Scenario
@try_manual
def call_scenario(test, rg_2, rg):
setup_scenario(test, rg_2, rg)
step_create(test, rg_2, rg, checks=[
test.check("name", "{myCommunicationService}", case_sensitive=False),
test.check("location", "Global", case_sensitive=False),
test.check("dataLocation", "United States", case_sensitive=False),
])
step_show(test, rg_2, rg, checks=[
test.check("name", "{myCommunicationService}", case_sensitive=False),
test.check("location", "Global", case_sensitive=False),
test.check("dataLocation", "United States", case_sensitive=False),
])
step_list(test, rg_2, rg, checks=[
test.check('length(@)', 1),
])
step_list2(test, rg_2, rg, checks=[
test.check('length(@)', 1),
])
step_update(test, rg_2, rg, checks=[
test.check("name", "{myCommunicationService}", case_sensitive=False),
test.check("location", "Global", case_sensitive=False),
test.check("dataLocation", "United States", case_sensitive=False),
test.check("tags.newTag", "newVal", case_sensitive=False),
])
step_link_notification_hub(test, rg_2, rg, checks=[])
step_list_key(test, rg_2, rg, checks=[])
step_regenerate_key(test, rg_2, rg, checks=[])
step_delete(test, rg_2, rg, checks=[])
cleanup_scenario(test, rg_2, rg)
# Test class for Scenario
@try_manual
class CommunicationScenarioTest(ScenarioTest):
def __init__(self, *args, **kwargs):
super(CommunicationScenarioTest, self).__init__(recording_processors=[], *args, **kwargs)
self.kwargs.update({
'subscription_id': self.get_subscription_id()
})
self.kwargs.update({
'myCommunicationService': self.create_random_name(prefix='MyCommunicationResource'[:11], length=23),
})
@AllowLargeResponse()
@ResourceGroupPreparer(name_prefix='clitestcommunication_MyOtherResourceGroup'[:7], key='rg_2',
parameter_name='rg_2')
@ResourceGroupPreparer(name_prefix='clitestcommunication_MyResourceGroup'[:7], key='rg', parameter_name='rg')
def test_communication_scenario(self, rg_2, rg):
call_scenario(self, rg_2, rg)
calc_coverage(__file__)
raise_if()