Merge pull request #420 from spulec/data-pipeline-improvements-2

Data pipeline improvements
This commit is contained in:
Steve Pulec 2015-09-17 15:33:33 -04:00
commit ba4b58ed0d
5 changed files with 27 additions and 20 deletions

View File

@ -30,6 +30,10 @@ class Pipeline(object):
self.objects = []
self.status = "PENDING"
@property
def physical_resource_id(self):
return self.pipeline_id
def to_meta_json(self):
return {
"id": self.pipeline_id,

View File

@ -31,9 +31,9 @@ class DataPipelineResponse(BaseResponse):
def list_pipelines(self):
pipelines = self.datapipeline_backend.list_pipelines()
return json.dumps({
"HasMoreResults": False,
"Marker": None,
"PipelineIdList": [
"hasMoreResults": False,
"marker": None,
"pipelineIdList": [
pipeline.to_meta_json() for pipeline in pipelines
]
})
@ -43,7 +43,7 @@ class DataPipelineResponse(BaseResponse):
pipelines = self.datapipeline_backend.describe_pipelines(pipeline_ids)
return json.dumps({
"PipelineDescriptionList": [
"pipelineDescriptionList": [
pipeline.to_json() for pipeline in pipelines
]
})
@ -67,11 +67,10 @@ class DataPipelineResponse(BaseResponse):
object_ids = self.parameters["objectIds"]
pipeline_objects = self.datapipeline_backend.describe_objects(object_ids, pipeline_id)
return json.dumps({
"HasMoreResults": False,
"Marker": None,
"PipelineObjects": [
"hasMoreResults": False,
"marker": None,
"pipelineObjects": [
pipeline_object.to_json() for pipeline_object in pipeline_objects
]
})

View File

@ -1462,7 +1462,7 @@ def test_datapipeline():
}
cf_conn = boto.cloudformation.connect_to_region("us-east-1")
template_json = json.dumps(dp_template)
cf_conn.create_stack(
stack_id = cf_conn.create_stack(
"test_stack",
template_body=template_json,
)
@ -1470,5 +1470,9 @@ def test_datapipeline():
dp_conn = boto.datapipeline.connect_to_region('us-east-1')
data_pipelines = dp_conn.list_pipelines()
data_pipelines['PipelineIdList'].should.have.length_of(1)
data_pipelines['PipelineIdList'][0]['name'].should.equal('testDataPipeline')
data_pipelines['pipelineIdList'].should.have.length_of(1)
data_pipelines['pipelineIdList'][0]['name'].should.equal('testDataPipeline')
stack_resources = cf_conn.list_stack_resources(stack_id)
stack_resources.should.have.length_of(1)
stack_resources[0].physical_resource_id.should.equal(data_pipelines['pipelineIdList'][0]['id'])

View File

@ -20,7 +20,7 @@ def test_create_pipeline():
res = conn.create_pipeline("mypipeline", "some-unique-id")
pipeline_id = res["pipelineId"]
pipeline_descriptions = conn.describe_pipelines([pipeline_id])["PipelineDescriptionList"]
pipeline_descriptions = conn.describe_pipelines([pipeline_id])["pipelineDescriptionList"]
pipeline_descriptions.should.have.length_of(1)
pipeline_description = pipeline_descriptions[0]
@ -105,7 +105,7 @@ def test_describing_pipeline_objects():
conn.put_pipeline_definition(PIPELINE_OBJECTS, pipeline_id)
objects = conn.describe_objects(["Schedule", "Default"], pipeline_id)['PipelineObjects']
objects = conn.describe_objects(["Schedule", "Default"], pipeline_id)['pipelineObjects']
objects.should.have.length_of(2)
default_object = [x for x in objects if x['id'] == 'Default'][0]
@ -125,7 +125,7 @@ def test_activate_pipeline():
pipeline_id = res["pipelineId"]
conn.activate_pipeline(pipeline_id)
pipeline_descriptions = conn.describe_pipelines([pipeline_id])["PipelineDescriptionList"]
pipeline_descriptions = conn.describe_pipelines([pipeline_id])["pipelineDescriptionList"]
pipeline_descriptions.should.have.length_of(1)
pipeline_description = pipeline_descriptions[0]
fields = pipeline_description['fields']
@ -141,14 +141,14 @@ def test_listing_pipelines():
response = conn.list_pipelines()
response["HasMoreResults"].should.be(False)
response["Marker"].should.be.none
response["PipelineIdList"].should.have.length_of(2)
response["PipelineIdList"].should.contain({
response["hasMoreResults"].should.be(False)
response["marker"].should.be.none
response["pipelineIdList"].should.have.length_of(2)
response["pipelineIdList"].should.contain({
"id": res1["pipelineId"],
"name": "mypipeline1",
})
response["PipelineIdList"].should.contain({
response["pipelineIdList"].should.contain({
"id": res2["pipelineId"],
"name": "mypipeline2"
})

View File

@ -23,5 +23,5 @@ def test_list_streams():
json_data = json.loads(res.data.decode("utf-8"))
json_data.should.equal({
'PipelineDescriptionList': []
'pipelineDescriptionList': []
})