Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Ping to azure-devtools==0.4.3 2. Change the test invocation in build.sh to reduce output from coverage. 3. Update coverage configuration 4. Fix missing storage test
- Loading branch information
Showing
9 changed files
with
121 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- |
105 changes: 105 additions & 0 deletions
105
...les/azure-cli-storage/azure/cli/command_modules/storage/tests/test_storage_url_helpers.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
import unittest | ||
from azure.cli.command_modules.storage.storage_url_helpers import StorageResourceIdentifier | ||
|
||
|
||
class TestStorageUrlHelpers(unittest.TestCase): | ||
def test_is_url(self): | ||
def _check_is_url(moniker, expectation): | ||
assert StorageResourceIdentifier(moniker).is_url() == expectation | ||
|
||
_check_is_url('sample', False) | ||
_check_is_url('http://test.blob.core.windows.net/cont', True) | ||
_check_is_url('https://test.blob.core.windows.net/cont', True) | ||
_check_is_url('https://test.file.core.windows.net/cont', True) | ||
|
||
def test_container_parsing(self): | ||
def _test(moniker, expected_container=None, expected_blob=None, expected_snapshot=None): | ||
i = StorageResourceIdentifier(moniker) | ||
|
||
if expected_container is not None: | ||
assert i.container == expected_container | ||
assert i.share is None | ||
assert i.directory is None | ||
assert i.filename is None | ||
else: | ||
assert i.container is None | ||
|
||
assert i.blob == expected_blob | ||
assert i.snapshot == expected_snapshot | ||
|
||
_test('sample') | ||
_test('https://momba.file.core.windows.net/snake') | ||
_test('http://momba.else.core.windows.net/snake') | ||
_test('http://momba.blob.core.windows.net/snake', 'snake') | ||
_test('https://momba.blob.core.windows.net/snake', 'snake') | ||
_test('https://momba.blob.core.windows.net/snake/blob', 'snake', 'blob') | ||
_test('https://momba.blob.core.windows.net/snake/blob/blob2', 'snake', 'blob/blob2') | ||
_test('https://momba.blob.core.windows.net/snake/blob?some=thing', 'snake', 'blob') | ||
|
||
def test_share_parsing(self): | ||
def _test(moniker, expected_share=None, expected_dir=None, expected_file=None): | ||
i = StorageResourceIdentifier(moniker) | ||
|
||
if expected_share is not None: | ||
assert i.container is None | ||
assert i.blob is None | ||
assert i.snapshot is None | ||
assert i.share == expected_share | ||
else: | ||
assert i.share is None | ||
|
||
assert i.directory == expected_dir | ||
assert i.filename == expected_file | ||
|
||
_test('sample') | ||
_test('https://momba.blob.core.windows.net/snake') | ||
_test('http://momba.blob.core.windows.net/snake') | ||
_test('http://momba.else.core.windows.net/snake') | ||
_test('http://momba.file.core.windows.net/snake/d/f.txt', 'snake', 'd', 'f.txt') | ||
_test('http://momba.file.core.windows.net/snake/f.txt', 'snake', '', 'f.txt') | ||
_test('http://momba.file.core.windows.net/snake/d/e/f.txt', 'snake', 'd/e', 'f.txt') | ||
_test('http://momba.file.core.windows.net/snake/d/e/f.txt?s=t', 'snake', 'd/e', 'f.txt') | ||
|
||
def test_account_name(self): | ||
def _test(moniker, expected_account=None): | ||
i = StorageResourceIdentifier(moniker) | ||
assert i.account_name == expected_account | ||
|
||
_test('sample') | ||
_test('https://momba.else.core.windows.net/snake') | ||
_test('https://momba.blob.core.windows.net/snake', 'momba') | ||
_test('http://momba.file.core.windows.net/snake', 'momba') | ||
_test('http://momba.file.core.windows.net/snake/d/e/f.txt?s=t', 'momba') | ||
|
||
def test_default_value(self): | ||
i = StorageResourceIdentifier('') | ||
assert not i.is_url() | ||
assert not i.is_valid | ||
assert i.account_name is None | ||
assert i.container is None | ||
assert i.blob is None | ||
assert i.share is None | ||
assert i.directory is None | ||
assert i.filename is None | ||
|
||
def test_get_sas_token(self): | ||
def _test(moniker, expected_sas=None): | ||
i = StorageResourceIdentifier(moniker) | ||
assert i.sas_token == expected_sas | ||
|
||
_test('https://momba.blob.core.windows.net/blob?sv=2015-04-05&ss=bfqt&srt=sco&sp=rwdlacup&se=' | ||
'2016-12-05T23:02:02Z&st=2016-12-05T15:02:02Z&spr=https&sig=e0xYWg%2F142F5uUsPBflsUVQqL' | ||
'33Pr0v3Fs5VIjsUL6A%3D', | ||
'sv=2015-04-05&ss=bfqt&srt=sco&sp=rwdlacup&se=2016-12-05T23:02:02Z&st=2016-12-05T15:02:' | ||
'02Z&spr=https&sig=e0xYWg%2F142F5uUsPBflsUVQqL33Pr0v3Fs5VIjsUL6A%3D') | ||
|
||
_test('https://momba.blob.core.windows.net/blob?sv=2015-04-05&ss=bfqt&srt=sco&sp=rwdlacup&se=' | ||
'2016-12-05T23:02:02Z&st=2016-12-05T15:02:02Z&spr=https&sig=e0xYWg%2F142F5uUsPBflsUVQqL' | ||
'33Pr0v3Fs5VIjsUL6A%3D&snapshot=2016-12-05T23:12:03.1181304Z', | ||
'sv=2015-04-05&ss=bfqt&srt=sco&sp=rwdlacup&se=2016-12-05T23:02:02Z&st=2016-12-05T15:02:' | ||
'02Z&spr=https&sig=e0xYWg%2F142F5uUsPBflsUVQqL33Pr0v3Fs5VIjsUL6A%3D') |
112 changes: 0 additions & 112 deletions
112
src/command_modules/azure-cli-storage/test_storage_url_helpers.py
This file was deleted.
Oops, something went wrong.