Add codepipeline.delete_pipeline

This commit is contained in:
gruebel 2019-12-15 17:58:38 +01:00
parent 9871eda3c9
commit 8e03b1d525
4 changed files with 683 additions and 13 deletions

File diff suppressed because it is too large Load Diff

View File

@ -142,6 +142,9 @@ class CodePipelineBackend(BaseBackend):
return sorted(pipelines, key=lambda i: i["name"])
def delete_pipeline(self, name):
self.pipelines.pop(name, None)
codepipeline_backends = {}
for region in Session().get_available_regions("codepipeline"):

View File

@ -34,3 +34,8 @@ class CodePipelineResponse(BaseResponse):
pipelines = self.codepipeline_backend.list_pipelines()
return json.dumps({"pipelines": pipelines})
def delete_pipeline(self):
self.codepipeline_backend.delete_pipeline(self._get_param("name"))
return ""

View File

@ -813,6 +813,74 @@ def test_list_pipelines():
)
@freeze_time("2019-01-01 12:00:00")
@mock_codepipeline
def test_delete_pipeline():
client = boto3.client("codepipeline", region_name="us-east-1")
client.create_pipeline(
pipeline={
"name": "test-pipeline",
"roleArn": get_role_arn(),
"artifactStore": {
"type": "S3",
"location": "codepipeline-us-east-1-123456789012",
},
"stages": [
{
"name": "Stage-1",
"actions": [
{
"name": "Action-1",
"actionTypeId": {
"category": "Source",
"owner": "AWS",
"provider": "S3",
"version": "1",
},
"configuration": {
"S3Bucket": "test-bucket",
"S3ObjectKey": "test-object",
},
"outputArtifacts": [{"name": "artifact"},],
},
],
},
{
"name": "Stage-2",
"actions": [
{
"name": "Action-1",
"actionTypeId": {
"category": "Approval",
"owner": "AWS",
"provider": "Manual",
"version": "1",
},
},
],
},
],
},
)
client.list_pipelines()["pipelines"].should.equal(
[
{
"name": "test-pipeline",
"version": 1,
"created": datetime.now(timezone.utc),
"updated": datetime.now(timezone.utc),
}
]
)
client.delete_pipeline(name="test-pipeline")
client.list_pipelines()["pipelines"].should.have.length_of(0)
# deleting a not existing pipeline, should raise no exception
client.delete_pipeline(name="test-pipeline")
@mock_iam
def get_role_arn():
iam = boto3.client("iam", region_name="us-east-1")