Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3089)

Unified Diff: appengine/findit/model/flake/test/flake_swarming_task_test.py

Issue 2345093002: [Findit] Extending versioned_model.py to support versioning multiple entities of the same class. (Closed)
Patch Set: Ignore this patch, uploaded unrelated change to wrong branch Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: appengine/findit/model/flake/test/flake_swarming_task_test.py
diff --git a/appengine/findit/model/flake/test/flake_swarming_task_test.py b/appengine/findit/model/flake/test/flake_swarming_task_test.py
index d87db20a22ca19ae23999a230cd53c2b5810c91e..acd4f2ed967dd7751f56df1aa597ec0e1cf4ecb0 100644
--- a/appengine/findit/model/flake/test/flake_swarming_task_test.py
+++ b/appengine/findit/model/flake/test/flake_swarming_task_test.py
@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+from datetime import datetime
+
import unittest
from model.flake.flake_swarming_task import FlakeSwarmingTask
@@ -13,3 +15,30 @@ class FlakeSwarmingTaskTest(unittest.TestCase):
task = FlakeSwarmingTask.Create('m', 'b', 121, 'browser_tests', 'test1')
self.assertEqual('browser_tests', task.step_name)
self.assertEqual('test1', task.test_name)
+
+ def testResultsToDict(self):
+ build_number = 121
+ created_time = datetime(2016, 9, 26, 12, 0, 0, 000000)
+ started_time = datetime(2016, 9, 26, 12, 1, 0, 000000)
+ end_time = datetime(2016, 9, 26, 12, 2, 0, 000000)
+ tries = 100
+ successes = 100
+
+ task = FlakeSwarmingTask.Create(
+ 'm', 'b', build_number, 'browser_tests', 'test1')
+ task.created_time = created_time
+ task.started_time = started_time
+ task.completed_time = end_time
+ task.tries = tries
+ task.successes = successes
+
+ expected_result_dict = {
+ 'created_time': created_time,
+ 'started_time': started_time,
+ 'completed_time': end_time,
+ 'build_number': build_number,
+ 'number_of_iterations': tries,
+ 'number_of_passes': successes
+ }
+
+ self.assertEqual(expected_result_dict, task.ResultsToDict())
« no previous file with comments | « appengine/findit/model/flake/master_flake_analysis_data.py ('k') | appengine/findit/model/test/versioned_model_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698