Bug bash fixes for release 0.16.0 (#904)

* Bug bash fixes for release 0.16.0

* Modify tests

* Update recording yml
This commit is contained in:
Ishita Mehta 2019-11-28 16:38:02 +05:30 коммит произвёл GitHub
Родитель d3f3ab6d03
Коммит 41bb6109e5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 1248 добавлений и 892 удалений

Просмотреть файл

@ -4,7 +4,7 @@
# --------------------------------------------------------------------------------------------
from azure.cli.core.commands.parameters import get_enum_type, get_three_state_flag
_EXPAND_TYPES = ['relations', 'fields', 'links', 'all']
_EXPAND_TYPES = ['none', 'relations', 'fields', 'links', 'all']
def load_work_arguments(self, _):
@ -26,7 +26,7 @@ def load_work_arguments(self, _):
with self.argument_context('boards work-item show') as context:
context.argument('expand', arg_type=get_enum_type(_EXPAND_TYPES))
context.argument('fields', nargs='*', options_list=('--fields', '-f'))
context.argument('fields', options_list=('--fields', '-f'))
with self.argument_context('boards work-item relation') as context:
context.argument('id', help='The ID of the work item')

Просмотреть файл

@ -202,11 +202,13 @@ def _handle_vsts_service_error(ex):
raise CLIError(ex)
def show_work_item(id, as_of=None, expand=None, fields=None, open=False, organization=None, detect=None): # pylint: disable=redefined-builtin
def show_work_item(id, as_of=None, expand='all', fields=None, open=False, organization=None, detect=None): # pylint: disable=redefined-builtin
"""Show details for a work item.
:param id: The ID of the work item
:type id: int
:param as_of: AsOf date time string Example: '2019-01-20 00:20:00'
:param as_of: Work item details as of a particular date and time. Provide a date or date time string.
Assumes local time zone. Example: '2019-01-20', '2019-01-20 00:20:00'.
For UTC, append 'UTC' to the date time string, '2019-01-20 00:20:00 UTC'.
:type as_of:string
:param expand: The expand parameters for work item attributes.
:type expand:str
@ -222,7 +224,7 @@ def show_work_item(id, as_of=None, expand=None, fields=None, open=False, organiz
client = get_work_item_tracking_client(organization)
as_of_iso = None
if as_of:
as_of_iso = convert_date_string_to_iso8601(value=as_of, argument='as_of')
as_of_iso = convert_date_string_to_iso8601(value=as_of, argument='as-of')
if fields:
fields = fields.split(',')
work_item = client.get_work_item(id, as_of=as_of_iso, fields=fields, expand=expand)

Просмотреть файл

@ -85,6 +85,7 @@ class CredentialStore:
keyring.delete_password(key, self._USERNAME)
except Exception as ex: # pylint: disable=broad-except
logger.debug("%s", ex)
finally:
file_token = self.get_PAT_from_file(key)
if file_token:
self.delete_PAT_from_file(key)

Просмотреть файл

@ -61,7 +61,7 @@ class TestWorkItemMethods(AuthenticatedTests):
# assert
self.mock_validate_token.assert_not_called()
self.mock_get_WI.assert_called_once_with(test_work_item_id,as_of=None, expand=None, fields=None)
self.mock_get_WI.assert_called_once_with(test_work_item_id,as_of=None, expand='all', fields=None)
assert response.id == test_work_item_id
@ -72,11 +72,11 @@ class TestWorkItemMethods(AuthenticatedTests):
# set return values
self.mock_get_WI.return_value.id = test_work_item_id
response = show_work_item(id=test_work_item_id, fields='System.Id', organization=self._TEST_DEVOPS_ORGANIZATION)
response = show_work_item(id=test_work_item_id, fields='System.Id,System.AreaPath', organization=self._TEST_DEVOPS_ORGANIZATION)
# assert
self.mock_validate_token.assert_not_called()
self.mock_get_WI.assert_called_once_with(test_work_item_id, as_of=None, fields=['System.Id'] ,expand=None)
self.mock_get_WI.assert_called_once_with(test_work_item_id, as_of=None, fields=['System.Id','System.AreaPath'] ,expand='all')
assert response.id == test_work_item_id
def test_show_work_item_correct_id_expand(self):
@ -106,7 +106,7 @@ class TestWorkItemMethods(AuthenticatedTests):
self.mock_validate_token.assert_not_called()
from azext_devops.dev.common.arguments import convert_date_string_to_iso8601
iso_date = convert_date_string_to_iso8601(as_of_date)
self.mock_get_WI.assert_called_once_with(test_work_item_id,as_of=iso_date, expand=None, fields=None)
self.mock_get_WI.assert_called_once_with(test_work_item_id,as_of=iso_date, expand='all', fields=None)
assert response.id == test_work_item_id
def test_show_work_item_correct_id_open_browser(self):
@ -121,7 +121,7 @@ class TestWorkItemMethods(AuthenticatedTests):
# assert
self.mock_open_browser.assert_called_with(response,self._TEST_DEVOPS_ORGANIZATION)
self.mock_validate_token.assert_not_called()
self.mock_get_WI.assert_called_once_with(test_work_item_id, as_of=None, expand=None, fields=None)
self.mock_get_WI.assert_called_once_with(test_work_item_id, as_of=None, expand='all', fields=None)
def test_show_work_item_raises_exception_invalid_id(self):
@ -135,7 +135,7 @@ class TestWorkItemMethods(AuthenticatedTests):
self.assertEqual(str(exc.exception),r'TF401232: Work item 1000 does not exist, or you do not have permissions to read it.')
#assert
self.mock_get_WI.assert_called_once_with(test_work_item_id, as_of=None, expand=None, fields=None)
self.mock_get_WI.assert_called_once_with(test_work_item_id, as_of=None, expand='all', fields=None)
self.mock_validate_token.assert_not_called()

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны