| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 base64 | 5 import base64 |
| 6 import unittest | 6 import unittest |
| 7 from webkitpy.common.host_mock import MockHost | 7 from webkitpy.common.host_mock import MockHost |
| 8 from webkitpy.w3c.github import GitHub | 8 from webkitpy.w3c.wpt_github import WPTGitHub |
| 9 | 9 |
| 10 | 10 |
| 11 class GitHubEnvTest(unittest.TestCase): | 11 class WPTGitHubEnvTest(unittest.TestCase): |
| 12 | 12 |
| 13 def setUp(self): | 13 def setUp(self): |
| 14 self.host = MockHost() | 14 self.host = MockHost() |
| 15 | 15 |
| 16 def test_requires_env_vars(self): | 16 def test_requires_env_vars(self): |
| 17 self.assertRaises(AssertionError, lambda: GitHub(self.host)) | 17 self.assertRaises(AssertionError, lambda: WPTGitHub(self.host)) |
| 18 | 18 |
| 19 def test_requires_gh_user_env_var(self): | 19 def test_requires_gh_user_env_var(self): |
| 20 self.host.environ['GH_USER'] = 'rutabaga' | 20 self.host.environ['GH_USER'] = 'rutabaga' |
| 21 self.assertRaises(AssertionError, lambda: GitHub(self.host)) | 21 self.assertRaises(AssertionError, lambda: WPTGitHub(self.host)) |
| 22 | 22 |
| 23 def test_requires_gh_token_env_var(self): | 23 def test_requires_gh_token_env_var(self): |
| 24 self.host.environ['GH_TOKEN'] = 'deadbeefcafe' | 24 self.host.environ['GH_TOKEN'] = 'deadbeefcafe' |
| 25 self.assertRaises(AssertionError, lambda: GitHub(self.host)) | 25 self.assertRaises(AssertionError, lambda: WPTGitHub(self.host)) |
| 26 | 26 |
| 27 | 27 |
| 28 class GitHubTest(unittest.TestCase): | 28 class WPTGitHubTest(unittest.TestCase): |
| 29 | 29 |
| 30 def setUp(self): | 30 def setUp(self): |
| 31 self.host = MockHost() | 31 self.host = MockHost() |
| 32 self.host.environ['GH_USER'] = 'rutabaga' | 32 self.host.environ['GH_USER'] = 'rutabaga' |
| 33 self.host.environ['GH_TOKEN'] = 'deadbeefcafe' | 33 self.host.environ['GH_TOKEN'] = 'deadbeefcafe' |
| 34 self.github = GitHub(self.host) | 34 self.wpt_github = WPTGitHub(self.host) |
| 35 | 35 |
| 36 def test_properties(self): | 36 def test_properties(self): |
| 37 self.assertEqual(self.github.user, 'rutabaga') | 37 self.assertEqual(self.wpt_github.user, 'rutabaga') |
| 38 self.assertEqual(self.github.token, 'deadbeefcafe') | 38 self.assertEqual(self.wpt_github.token, 'deadbeefcafe') |
| 39 | 39 |
| 40 def test_auth_token(self): | 40 def test_auth_token(self): |
| 41 expected = base64.encodestring('rutabaga:deadbeefcafe') | 41 expected = base64.encodestring('rutabaga:deadbeefcafe') |
| 42 self.assertEqual(self.github.auth_token(), expected) | 42 self.assertEqual(self.wpt_github.auth_token(), expected) |
| 43 | |
| 44 # TODO(jeffcarp): add create_pr tests | |
| OLD | NEW |