def test_no_runs_available(self): stream = six.StringIO() formatter = ListRunsFormatter(stream) objects = [] formatter.display_objects_to_user(objects) self.assertEqual( [line.strip() for line in stream.getvalue().splitlines()], [line.strip() for line in EMPTY_RUNS.splitlines()])
def test_single_row(self): objects = [ {'@componentParent': 'parent', '@id': 'id', '@scheduledStartTime': 'now', '@status': 'status', '@actualStartTime': 'actualStartTime', '@actualEndTime': 'actualEndTime', } ] stream = six.StringIO() formatter = ListRunsFormatter(stream) formatter.display_objects_to_user(objects) # Rather than stream.getvalue() == SINGLE_ROW_RUN # we compare equality like this to avoid test failures # for differences in leading/trailing whitespace and empty lines. self.assertEqual( [line.strip() for line in stream.getvalue().splitlines() if line.strip()], [line.strip() for line in SINGLE_ROW_RUN.splitlines() if line.strip()])
def test_single_row(self): objects = [{ '@componentParent': 'parent', '@id': 'id', '@scheduledStartTime': 'now', '@status': 'status', '@actualStartTime': 'actualStartTime', '@actualEndTime': 'actualEndTime', }] stream = six.StringIO() formatter = ListRunsFormatter(stream) formatter.display_objects_to_user(objects) # Rather than stream.getvalue() == SINGLE_ROW_RUN # we compare equality like this to avoid test failures # for differences in leading/trailing whitespace and empty lines. self.assertEqual([ line.strip() for line in stream.getvalue().splitlines() if line.strip() ], [ line.strip() for line in SINGLE_ROW_RUN.splitlines() if line.strip() ])