Change fields to be start with lower case based on examing of real AWS calls.
This commit is contained in:
parent
a7e23e45fd
commit
65dd7f7639
@ -14,9 +14,9 @@ class PipelineObject(object):
|
||||
|
||||
def to_json(self):
|
||||
return {
|
||||
"Fields": self.fields,
|
||||
"Id": self.object_id,
|
||||
"Name": self.name,
|
||||
"fields": self.fields,
|
||||
"id": self.object_id,
|
||||
"name": self.name,
|
||||
}
|
||||
|
||||
|
||||
@ -30,10 +30,16 @@ class Pipeline(object):
|
||||
self.objects = []
|
||||
self.status = "PENDING"
|
||||
|
||||
def to_meta_json(self):
|
||||
return {
|
||||
"id": self.pipeline_id,
|
||||
"name": self.name,
|
||||
}
|
||||
|
||||
def to_json(self):
|
||||
return {
|
||||
"Description": self.description,
|
||||
"Fields": [{
|
||||
"description": self.description,
|
||||
"fields": [{
|
||||
"key": "@pipelineState",
|
||||
"stringValue": self.status,
|
||||
}, {
|
||||
@ -64,9 +70,9 @@ class Pipeline(object):
|
||||
"key": "uniqueId",
|
||||
"stringValue": self.unique_id
|
||||
}],
|
||||
"Name": self.name,
|
||||
"PipelineId": self.pipeline_id,
|
||||
"Tags": [
|
||||
"name": self.name,
|
||||
"pipelineId": self.pipeline_id,
|
||||
"tags": [
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ class DataPipelineResponse(BaseResponse):
|
||||
"HasMoreResults": False,
|
||||
"Marker": None,
|
||||
"PipelineIdList": [
|
||||
{"Id": pipeline.pipeline_id, "Name": pipeline.name} for pipeline in pipelines
|
||||
pipeline.to_meta_json() for pipeline in pipelines
|
||||
]
|
||||
})
|
||||
|
||||
|
@ -24,9 +24,9 @@ def test_create_pipeline():
|
||||
pipeline_descriptions.should.have.length_of(1)
|
||||
|
||||
pipeline_description = pipeline_descriptions[0]
|
||||
pipeline_description['Name'].should.equal("mypipeline")
|
||||
pipeline_description["PipelineId"].should.equal(pipeline_id)
|
||||
fields = pipeline_description['Fields']
|
||||
pipeline_description['name'].should.equal("mypipeline")
|
||||
pipeline_description["pipelineId"].should.equal(pipeline_id)
|
||||
fields = pipeline_description['fields']
|
||||
|
||||
get_value_from_fields('@pipelineState', fields).should.equal("PENDING")
|
||||
get_value_from_fields('uniqueId', fields).should.equal("some-unique-id")
|
||||
@ -89,9 +89,9 @@ def test_creating_pipeline_definition():
|
||||
pipeline_definition = conn.get_pipeline_definition(pipeline_id)
|
||||
pipeline_definition['pipelineObjects'].should.have.length_of(3)
|
||||
default_object = pipeline_definition['pipelineObjects'][0]
|
||||
default_object['Name'].should.equal("Default")
|
||||
default_object['Id'].should.equal("Default")
|
||||
default_object['Fields'].should.equal([{
|
||||
default_object['name'].should.equal("Default")
|
||||
default_object['id'].should.equal("Default")
|
||||
default_object['fields'].should.equal([{
|
||||
"key": "workerGroup",
|
||||
"stringValue": "workerGroup"
|
||||
}])
|
||||
@ -108,9 +108,9 @@ def test_describing_pipeline_objects():
|
||||
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]
|
||||
default_object['Name'].should.equal("Default")
|
||||
default_object['Fields'].should.equal([{
|
||||
default_object = [x for x in objects if x['id'] == 'Default'][0]
|
||||
default_object['name'].should.equal("Default")
|
||||
default_object['fields'].should.equal([{
|
||||
"key": "workerGroup",
|
||||
"stringValue": "workerGroup"
|
||||
}])
|
||||
@ -128,7 +128,7 @@ def test_activate_pipeline():
|
||||
pipeline_descriptions = conn.describe_pipelines([pipeline_id])["PipelineDescriptionList"]
|
||||
pipeline_descriptions.should.have.length_of(1)
|
||||
pipeline_description = pipeline_descriptions[0]
|
||||
fields = pipeline_description['Fields']
|
||||
fields = pipeline_description['fields']
|
||||
|
||||
get_value_from_fields('@pipelineState', fields).should.equal("SCHEDULED")
|
||||
|
||||
@ -138,8 +138,6 @@ def test_listing_pipelines():
|
||||
conn = boto.datapipeline.connect_to_region("us-west-2")
|
||||
res1 = conn.create_pipeline("mypipeline1", "some-unique-id1")
|
||||
res2 = conn.create_pipeline("mypipeline2", "some-unique-id2")
|
||||
pipeline_id1 = res1["pipelineId"]
|
||||
pipeline_id2 = res2["pipelineId"]
|
||||
|
||||
response = conn.list_pipelines()
|
||||
|
||||
@ -147,12 +145,12 @@ def test_listing_pipelines():
|
||||
response["Marker"].should.be.none
|
||||
response["PipelineIdList"].should.have.length_of(2)
|
||||
response["PipelineIdList"].should.contain({
|
||||
"Id": res1["pipelineId"],
|
||||
"Name": "mypipeline1",
|
||||
"id": res1["pipelineId"],
|
||||
"name": "mypipeline1",
|
||||
})
|
||||
response["PipelineIdList"].should.contain({
|
||||
"Id": res2["pipelineId"],
|
||||
"Name": "mypipeline2"
|
||||
"id": res2["pipelineId"],
|
||||
"name": "mypipeline2"
|
||||
})
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user