Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
418b2a1
Introduce LocationBasedServices command_module
jp94 Feb 23, 2018
8bbcd51
Introduce test cases for LocationBasedServices command_module
jp94 Feb 23, 2018
18d9384
[Refactor] Renamed lbs to locationbasedservices
jp94 Feb 24, 2018
cb738db
[Refactor] Renamed lbs to locationbasedservices
jp94 Feb 24, 2018
b74cb79
[Legal] Add the Preview Terms agreement requirement
jp94 Feb 24, 2018
409b03b
[Test] Add more strict assertion rule for key validation.
jp94 Feb 26, 2018
ed3ca01
[Test] Add test for tags parameter
jp94 Feb 26, 2018
81e4fb5
[Test] Added an additional resource group.
jp94 Feb 26, 2018
0d11a6d
[Test] Init recordings
jp94 Feb 26, 2018
87accc7
Merge remote-tracking branch 'upstream/dev' into dev
jp94 Feb 26, 2018
9e5051f
[Pylint] Specify string format arguments as logging function parameters
jp94 Feb 26, 2018
77a9f22
[Refactor] Update description in _help to match the general template
jp94 Feb 27, 2018
98d973e
[Refactor] General template mismatch fix for 'key'
jp94 Feb 27, 2018
5853331
[Feature] Introduce search by ids
jp94 Feb 28, 2018
4d930f8
[Temporary] Throw an exception on 'account show' command, when nonexist
jp94 Feb 28, 2018
d36abf9
[Test] 'account show' on non-existent account should not return empty.
jp94 Feb 28, 2018
b79cb10
[Feature] Introduce update command
jp94 Mar 1, 2018
75795e6
[Test] Add test for update and search by id
jp94 Mar 1, 2018
100df29
Merge remote-tracking branch 'upstream/dev' into dev
jp94 Mar 20, 2018
1fd7bef
[Refactor] Rename generic client (sync with updated Swagger)
jp94 Mar 21, 2018
1aee6b2
[Refactor] Use default SDK's function
jp94 Mar 21, 2018
35976e7
[Refactor] Remove Preview Terms & docs in custom.py
jp94 Mar 21, 2018
e7784a1
[Maps] Rename LocationBasedServices to Maps
jp94 May 7, 2018
f9ca47d
[Maps] Use Maps SDK from LocationBasedServices SDK
jp94 May 7, 2018
52b9dde
[Maps] Update dependencies
jp94 May 7, 2018
c0c8bb8
[Maps] Resolving build error (doc_source_map)
jp94 May 7, 2018
498ca9c
Merge remote-tracking branch 'upstream/dev' into rename
jp94 May 8, 2018
4176c07
Merge remote-tracking branch 'upstream/dev' into rename
jp94 May 9, 2018
c6c5c02
[Maps] Resolving PR issues.
jp94 May 9, 2018
31f7a3a
[Maps] Revise help text
jp94 May 9, 2018
d49f8ad
[Maps] Adding back help docs for maps account
jp94 May 9, 2018
1f3d2c1
Merge remote-tracking branch 'upstream/dev' into rename
jp94 May 12, 2018
19b2fe9
[Load Test] replace sql with servicefabric
jp94 May 14, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Test] Add test for tags parameter
  • Loading branch information
jp94 committed Feb 26, 2018
commit ed3ca0121c3b6a0379342b5a89b05c9e2ebfedb7
Original file line number Diff line number Diff line change
Expand Up @@ -11,56 +11,71 @@

class LocationBasedServicesScenarioTests(ScenarioTest):

@ResourceGroupPreparer()
@ResourceGroupPreparer(key='rg')
def test_create_locationbasedservices_account(self, resource_group):
tag_key = self.create_random_name(prefix='key-', length=10)
tag_value = self.create_random_name(prefix='val-', length=10)

self.kwargs.update({
'name': self.create_random_name(prefix='cli-', length=20),
'name1': self.create_random_name(prefix='cli-', length=20),
'name2': self.create_random_name(prefix='cli-', length=20),
'sku': 'S0',
'tags': 'a=b',
'tags': tag_key + '=' + tag_value,
'key_type_primary': KeyType.primary.value,
'key_type_secondary': KeyType.secondary.value
})

# Test 'az locationbasedservices account create'
# Test to create an LocationBasedServices account
# Test 'az locationbasedservices account create'.
# Test to create a LocationBasedServices account.
account = self.cmd('az locationbasedservices account create -n {name} -g {rg} --sku {sku} ' +
'--agree-to-the-preview-terms',
checks=[
self.check('name', '{name}'),
self.check('resourceGroup', '{rg}'),
self.check('sku.name', '{sku}')
self.check('sku.name', '{sku}'),
self.check('tags', None)
]).get_output_in_json()

# Call create again, expect to get the same account
# Call create again, expect to get the same account.
account_duplicated = self.cmd(
'az locationbasedservices account create -n {name} -g {rg} --sku {sku} ' +
'--agree-to-the-preview-terms').get_output_in_json()
self.assertEqual(account, account_duplicated)

# Test 'az locationbasedservices account show'
# Test to get information on LocationBasedServices account
# Test update/override a LocationBasedServices account with tags param update.
self.cmd('az locationbasedservices account create -n {name} -g {rg} --sku {sku} --tags {tags} ' +
'--agree-to-the-preview-terms',
checks=[
self.check('id', account['id']),
self.check('name', '{name}'),
self.check('resourceGroup', '{rg}'),
self.check('sku.name', '{sku}'),
self.check('tags', {tag_key: tag_value})
])

# Test 'az locationbasedservices account show'.
# Test to get information on LocationBasedServices account.
self.cmd('az locationbasedservices account show -n {name} -g {rg}', checks=[
self.check('id', account['id']),
self.check('name', '{name}'),
self.check('resourceGroup', '{rg}'),
self.check('sku.name', '{sku}')
])

# Test 'az locationbasedservices account list'
# Test to list all LocationBasedServices accounts under a resource group
# Test 'az locationbasedservices account list'.
# Test to list all LocationBasedServices accounts under a resource group.
self.cmd('az locationbasedservices account list -g {rg}', checks=[
self.check('length(@)', 1),
self.check('type(@)', 'array'),
self.check('[0].id', account['id']),
self.check('[0].name', '{name}'),
self.check('[0].resourceGroup', '{rg}'),
self.check('[0].sku.name', '{sku}'),
self.check('[0].tags', None)
self.check('[0].tags', {tag_key: tag_value})
])

# Create two new accounts
# Create two new accounts.
self.cmd('az locationbasedservices account create -n {name1} -g {rg} --sku {sku} ' +
'--agree-to-the-preview-terms')
self.cmd('az locationbasedservices account create -n {name2} -g {rg} --sku {sku} ' +
Expand All @@ -75,21 +90,21 @@ def test_create_locationbasedservices_account(self, resource_group):
self.check("length([?resourceGroup == '{rg}'])", 3)
])

# Test 'az locationbasedservices account key list'
# Test to list keys for an LocationBasedServices account
# Test 'az locationbasedservices account key list'.
# Test to list keys for an LocationBasedServices account.
account_key_list = self.cmd('az locationbasedservices account key list -n {name} -g {rg}', checks=[
self.check('id', account['id']),
self.check('resourceGroup', '{rg}')
]).get_output_in_json()

# Retrieve primary and secondary keys
# Retrieve primary and secondary keys.
primary_key_old = account_key_list['primaryKey']
secondary_key_old = account_key_list['secondaryKey']
self.assertTrue(re.match('^[a-zA-Z0-9_-]+$', primary_key_old))
self.assertTrue(re.match('^[a-zA-Z0-9_-]+$', secondary_key_old))

# Test 'az locationbasedservices account key regenerate'
# Test to change primary and secondary keys for an LocationBasedServices account
# Test 'az locationbasedservices account key regenerate'.
# Test to change primary and secondary keys for an LocationBasedServices account.
key_regenerated = self.cmd(
'az locationbasedservices account key regenerate -n {name} -g {rg} -t {key_type_primary}', checks=[
self.check('id', account['id']),
Expand All @@ -108,16 +123,16 @@ def test_create_locationbasedservices_account(self, resource_group):
self.assertEqual(primary_key_old, key_regenerated['primaryKey'])
self.assertNotEqual(secondary_key_old, key_regenerated['secondaryKey'])

# Test 'az locationbasedservices account delete'
# Test to remove an LocationBasedServices account
# Test 'az locationbasedservices account delete'.
# Test to remove an LocationBasedServices account.
self.cmd('az locationbasedservices account delete -n {name} -g {rg}', checks=self.is_empty())
self.cmd('az locationbasedservices account show -n {name} -g {rg}', checks=self.is_empty())
self.cmd('az locationbasedservices account list -g {rg}', checks=[
self.check('length(@)', 2),
self.check("length([?name == '{name}'])", 0)
])

# Remove the rest of LocationBasedServices accounts
# Remove the rest of LocationBasedServices accounts.
exit_code = self.cmd('az locationbasedservices account delete -n {name1} -g {rg}').exit_code
self.assertEqual(exit_code, 0)
self.cmd('az locationbasedservices account delete -n {name2} -g {rg}')
Expand Down