| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import sys | |
| 6 import os | 5 import os |
| 7 | 6 |
| 8 # App Engine source file imports must be relative to their app's root. | 7 from appengine.path_mangler_hack import PathMangler |
| 9 sys.path.append(os.path.dirname(os.path.dirname(__file__))) | 8 with PathMangler(os.path.dirname(os.path.dirname(__file__))): |
| 10 | 9 from appengine.utils import testing |
| 11 from appengine.utils import testing | 10 from appengine.chromium_cq_status.shared import utils |
| 12 from appengine.chromium_cq_status.shared import utils | |
| 13 | 11 |
| 14 class TestUtils(testing.AppengineTestCase): | 12 class TestUtils(testing.AppengineTestCase): |
| 15 def test_filter_dict(self): | 13 def test_filter_dict(self): |
| 16 self.assertEquals( | 14 self.assertEquals( |
| 17 {'b': 2, 'c': 3}, | 15 {'b': 2, 'c': 3}, |
| 18 utils.filter_dict({'a': 1, 'b': 2, 'c': 3}, ('b', 'c', 'd'))) | 16 utils.filter_dict({'a': 1, 'b': 2, 'c': 3}, ('b', 'c', 'd'))) |
| 19 | 17 |
| 20 def test_is_valid_user(self): | 18 def test_is_valid_user(self): |
| 21 self.assertFalse(utils.is_valid_user()) | 19 self.assertFalse(utils.is_valid_user()) |
| 22 | 20 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 38 self.mock_current_user('fake', 'fake@chromium.orgg') | 36 self.mock_current_user('fake', 'fake@chromium.orgg') |
| 39 self.assertFalse(utils.is_valid_user()) | 37 self.assertFalse(utils.is_valid_user()) |
| 40 | 38 |
| 41 self.mock_current_user('fake', 'fake@chromium_org') | 39 self.mock_current_user('fake', 'fake@chromium_org') |
| 42 self.assertFalse(utils.is_valid_user()) | 40 self.assertFalse(utils.is_valid_user()) |
| 43 | 41 |
| 44 def test_password_sha1(self): | 42 def test_password_sha1(self): |
| 45 self.assertEquals( | 43 self.assertEquals( |
| 46 '018d644a17b71b65cef51fa0a523a293f2b3266f', | 44 '018d644a17b71b65cef51fa0a523a293f2b3266f', |
| 47 utils.password_sha1('cq')) | 45 utils.password_sha1('cq')) |
| OLD | NEW |