@ -298,6 +298,27 @@ def test_build_requirement_from_tar(collection_artifact):
assert actual . ver == u ' 0.1.0 '
def test_build_requirement_from_tar_url ( tmp_path_factory ) :
test_dir = to_bytes ( tmp_path_factory . mktemp ( ' test-ÅÑŚÌβŁÈ Collections Input ' ) )
concrete_artifact_cm = collection . concrete_artifact_manager . ConcreteArtifactsManager ( test_dir , validate_certs = False )
test_url = ' https://example.com/org/repo/sample.tar.gz '
expected = fr " ^Failed to download collection tar from ' { to_text ( test_url ) } ' "
with pytest . raises ( AnsibleError , match = expected ) :
Requirement . from_requirement_dict ( { ' name ' : test_url , ' type ' : ' url ' } , concrete_artifact_cm )
def test_build_requirement_from_tar_url_wrong_type ( tmp_path_factory ) :
test_dir = to_bytes ( tmp_path_factory . mktemp ( ' test-ÅÑŚÌβŁÈ Collections Input ' ) )
concrete_artifact_cm = collection . concrete_artifact_manager . ConcreteArtifactsManager ( test_dir , validate_certs = False )
test_url = ' https://example.com/org/repo/sample.tar.gz '
expected = fr " ^Unable to find collection artifact file at ' { to_text ( test_url ) } ' \ .$ "
with pytest . raises ( AnsibleError , match = expected ) :
# Specified wrong collection type for http URL
Requirement . from_requirement_dict ( { ' name ' : test_url , ' type ' : ' file ' } , concrete_artifact_cm )
def test_build_requirement_from_tar_fail_not_tar ( tmp_path_factory ) :
test_dir = to_bytes ( tmp_path_factory . mktemp ( ' test-ÅÑŚÌβŁÈ Collections Input ' ) )
test_file = os . path . join ( test_dir , b ' fake.tar.gz ' )