Path: blob/develop/tests/functional/datapipeline/test_list_runs.py
1567 views
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.1#2# Licensed under the Apache License, Version 2.0 (the "License"). You3# may not use this file except in compliance with the License. A copy of4# the License is located at5#6# http://aws.amazon.com/apache2.0/7#8# or in the "license" file accompanying this file. This file is9# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF10# ANY KIND, either express or implied. See the License for the specific11# language governing permissions and limitations under the License.12from awscli.testutils import BaseAWSCommandParamsTest131415class TestDataPipelineQueryObjects(BaseAWSCommandParamsTest):16maxDiff = None1718prefix = 'datapipeline list-runs '1920def _generate_pipeline_objects(self, object_ids):21objects = []22for object_id in object_ids:23objects.append({24'id': object_id,25'name': object_id,26'fields': [27{'key': '@componentParent', 'stringValue': object_id}28]29})30return objects3132def test_list_more_than_one_hundred_runs(self):33start_date = '2017-10-22T00:37:21'34end_date = '2017-10-26T00:37:21'35pipeline_id = 'pipeline-id'36args = '--pipeline-id %s --start-interval %s,%s' % (37pipeline_id, start_date, end_date38)39command = self.prefix + args40object_ids = ['object-id-%s' % i for i in range(150)]41objects = self._generate_pipeline_objects(object_ids)4243self.parsed_responses = [44{45'ids': object_ids[:100],46'hasMoreResults': True,47'marker': 'marker'48},49{50'ids': object_ids[100:],51'hasMoreResults': False52},53{'pipelineObjects': objects[:100]},54{'pipelineObjects': objects[100:]}55]5657self.run_cmd(command, expected_rc=None)5859query = {60'selectors': [{61'fieldName': '@actualStartTime',62'operator': {63'type': 'BETWEEN',64'values': [start_date, end_date]65}66}]67}6869expected_operations_called = [70('QueryObjects', {71'pipelineId': pipeline_id,72'query': query, 'sphere': 'INSTANCE'73}),74('QueryObjects', {75'pipelineId': pipeline_id,76'marker': 'marker', 'query': query, 'sphere': 'INSTANCE'77}),78('DescribeObjects', {79'objectIds': object_ids[:100],80'pipelineId': pipeline_id81}),82('DescribeObjects', {83'objectIds': object_ids[100:],84'pipelineId': pipeline_id85})86]87operations_called = [(op.name, params)88for op, params in self.operations_called]89self.assertEqual(expected_operations_called, operations_called)909192