Chromium Code Reviews| Index: appengine/findit/waterfall/test/process_base_swarming_task_result_pipeline_test.py |
| diff --git a/appengine/findit/waterfall/test/process_base_swarming_task_result_pipeline_test.py b/appengine/findit/waterfall/test/process_base_swarming_task_result_pipeline_test.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5f49435159b1eaee1ce98ac3cc290c5079f7f0ee |
| --- /dev/null |
| +++ b/appengine/findit/waterfall/test/process_base_swarming_task_result_pipeline_test.py |
| @@ -0,0 +1,36 @@ |
| +import datetime |
| + |
| +from waterfall.test import wf_testcase |
| +from waterfall.process_base_swarming_task_result_pipeline import ( |
| + ProcessBaseSwarmingTaskResultPipeline) |
| + |
| +class ProcessBaseSwarmingTaskResultPipelineTest(wf_testcase.WaterfallTestCase): |
| + def setUp(self): |
| + super(ProcessBaseSwarmingTaskResultPipelineTest, self).setUp() |
| + self.pipeline = ProcessBaseSwarmingTaskResultPipeline() |
| + self.master_name = 'm' |
| + self.builder_name = 'b' |
| + self.build_number = 121 |
| + self.step_name = 'abc_tests on platform' |
| + self.test_name = 'test' |
| + |
| + def testConvertDateTime(self): |
| + fmt = '%Y-%m-%dT%H:%M:%S.%f' |
| + time_string = '2016-02-10T18:32:06.538220' |
| + test_time = self.pipeline._ConvertDateTime(time_string) |
| + time = datetime.datetime.strptime(time_string, fmt) |
| + self.assertEqual(test_time,time) |
|
lijeffrey
2016/07/27 22:38:23
nit: space after ,
caiw
2016/07/27 23:51:33
Done.
|
| + |
| + def testConvertDateTimeNone(self): |
| + time_string = '' |
| + test_time = self.pipeline._ConvertDateTime(time_string) |
| + self.assertIsNone(test_time) |
| + |
| + def testConvertDateTimefailure(self): |
| + time_string = 'fdjasklfdhjsakfhjdkalsf' |
|
lijeffrey
2016/07/27 22:38:23
lol. use 'abc' or something
caiw
2016/07/27 23:51:33
Done.
|
| + try: |
| + #pylint: disable=unused-variable |
| + test_time = self.pipeline._ConvertDateTime(time_string) |
| + self.assertEqual(1,2) # pragma: no cover |
|
lijeffrey
2016/07/27 22:38:23
what?
caiw
2016/07/27 23:51:33
The idea is that if the code is working properly i
|
| + except ValueError: |
| + pass |