OLD | NEW |
(Empty) | |
| 1 # Copyright 2016 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 dashboard.pinpoint.models.change import patch |
| 8 |
| 9 |
| 10 class PatchTest(unittest.TestCase): |
| 11 |
| 12 def testPatch(self): |
| 13 p = patch.Patch('https://codereview.chromium.org', 2851943002, 40001) |
| 14 |
| 15 other_patch = patch.Patch(u'https://codereview.chromium.org', |
| 16 2851943002, 40001) |
| 17 self.assertEqual(p, other_patch) |
| 18 string = 'https://codereview.chromium.org/2851943002/40001' |
| 19 self.assertEqual(str(p), string) |
| 20 self.assertEqual(p.id_string, string) |
| 21 |
| 22 def testAsDict(self): |
| 23 p = patch.Patch('https://codereview.chromium.org', 2851943002, 40001) |
| 24 expected = { |
| 25 'server': 'https://codereview.chromium.org', |
| 26 'issue': 2851943002, |
| 27 'patchset': 40001, |
| 28 } |
| 29 self.assertEqual(p.AsDict(), expected) |
| 30 |
| 31 def testFromDict(self): |
| 32 p = patch.Patch.FromDict({ |
| 33 'server': 'https://codereview.chromium.org', |
| 34 'issue': 2851943002, |
| 35 'patchset': 40001, |
| 36 }) |
| 37 |
| 38 expected = patch.Patch('https://codereview.chromium.org', 2851943002, 40001) |
| 39 self.assertEqual(p, expected) |
OLD | NEW |