Skip to content

Commit

Permalink
test_reposImportTest Fixed (#1185)
Browse files Browse the repository at this point in the history
Co-authored-by: Roshan-sy <roshan-sy@github.com>
  • Loading branch information
roshan-sy and Roshan-sy committed Sep 2, 2021
1 parent 8cb419b commit 61ba68e
Show file tree
Hide file tree
Showing 2 changed files with 470 additions and 371 deletions.
828 changes: 463 additions & 365 deletions tests/recordings/test_repos_import_create.yaml

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions tests/test_reposImportTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from azure_devtools.scenario_tests import AllowLargeResponse
from .utilities.helper import DevopsScenarioTest, disable_telemetry, set_authentication, get_test_org_from_env_variable, get_random_name

DEVOPS_CLI_TEST_ORGANIZATION = get_test_org_from_env_variable() or 'Https://dev.azure.com/azuredevopsclitest'
DEVOPS_CLI_TEST_ORGANIZATION = get_test_org_from_env_variable() or 'Https://dev.azure.com/devops-cli-test-org'

class ReposImportTests(DevopsScenarioTest):
@AllowLargeResponse(size_kb=3072)
Expand All @@ -22,17 +22,18 @@ def test_repos_import_create(self):

try:
#Create a repo with random name
create_repo_command = 'az repos create --detect false --name ' + random_repo_name +' --project ImportRepoTest --output json'
print(DEVOPS_CLI_TEST_ORGANIZATION)
create_repo_command = 'az repos create --detect false --name ' + random_repo_name +' --project TestSupportProject --output json'
repo_create_output = self.cmd(create_repo_command).get_output_in_json()
created_repo_id = repo_create_output["id"]
assert len(created_repo_id) > 0

#Import repo
import_repo_command = 'az repos import create --git-source-url https://dev.azure.com/AzureDevOpsCliTest/ImportRepoTest/_git/snakes-and-ladders --repository ' + created_repo_id + ' --project ImportRepoTest --detect false --output json'
import_repo_command = 'az repos import create --git-source-url https://dev.azure.com/devops-cli-test-org/TestSupportProject/_git/snakes-and-ladders --repository ' + created_repo_id + ' --project TestSupportProject --detect false --output json'
import_repo_output = self.cmd(import_repo_command).get_output_in_json()
import_repo_status = import_repo_output["status"]
assert import_repo_status == 'completed'
list_repo_command = 'az repos list --project ImportRepoTest --output json --detect false'
list_repo_command = 'az repos list --project TestSupportProject --output json --detect false'
verified_repo_list = False
list_repo_output_before_delete = self.cmd(list_repo_command).get_output_in_json()
for repos in list_repo_output_before_delete:
Expand All @@ -43,8 +44,8 @@ def test_repos_import_create(self):

finally:
#TestCleanup - Delete the temporary repo we created for the test
list_repo_command = 'az repos list --project ImportRepoTest --output json --detect false'
delete_repo_command = 'az repos delete --detect false --id ' + created_repo_id + ' --project ImportRepoTest -y --output json'
list_repo_command = 'az repos list --project TestSupportProject --output json --detect false'
delete_repo_command = 'az repos delete --detect false --id ' + created_repo_id + ' --project TestSupportProject -y --output json'
self.cmd(delete_repo_command)

#Verify Deletion
Expand Down

0 comments on commit 61ba68e

Please sign in to comment.