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

Side by Side Diff: appengine/findit/common/test/blame_test.py

Issue 2344443005: [Findit] Factoring the gitiles (etc) stuff out into its own directory (Closed)
Patch Set: reordering imports Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import unittest
6
7 from common.blame import Blame
8 from common.blame import Region
9
10 class BlameTest(unittest.TestCase):
11 REGION1 = Region(1, 5, 'abc', 'a', 'a@email.com', '2014-08-14 19:38:42')
12 REGION1_EXPECTED_JSON = {
13 'start': 1,
14 'count': 5,
15 'revision': 'abc',
16 'author_name': 'a',
17 'author_email': 'a@email.com',
18 'author_time': '2014-08-14 19:38:42'
19 }
20
21 REGION2 = Region(6, 10, 'def', 'b', 'b@email.com', '2014-08-19 19:38:42')
22 REGION2_EXPECTED_JSON = {
23 'start': 6,
24 'count': 10,
25 'revision': 'def',
26 'author_name': 'b',
27 'author_email': 'b@email.com',
28 'author_time': '2014-08-19 19:38:42'
29 }
30
31 def testRegionToDict(self):
32 self.assertEqual(self.REGION1_EXPECTED_JSON, self.REGION1.ToDict())
33 self.assertEqual(self.REGION2_EXPECTED_JSON, self.REGION2.ToDict())
34
35 def testBlameToDict(self):
36 blame = Blame('def', 'a/c.cc')
37 blame.AddRegion(self.REGION1)
38 blame.AddRegion(self.REGION2)
39 blame_json = blame.ToDict()
40 self.assertEqual(3, len(blame_json))
41 self.assertEqual('def', blame_json['revision'])
42 self.assertEqual('a/c.cc', blame_json['path'])
43 self.assertEqual(self.REGION1_EXPECTED_JSON, blame_json['regions'][0])
44 self.assertEqual(self.REGION2_EXPECTED_JSON, blame_json['regions'][1])
OLDNEW
« no previous file with comments | « appengine/findit/common/test/base_handler_test.py ('k') | appengine/findit/common/test/cache_decorator_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698