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 base64 | 5 import base64 |
6 from datetime import datetime | 6 from datetime import datetime |
7 import json | 7 import json |
8 import re | 8 import re |
9 | 9 |
10 from testing_utils import testing | 10 from testing_utils import testing |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 257 |
258 class GitRepositoryTest(TestCase): | 258 class GitRepositoryTest(TestCase): |
259 | 259 |
260 def setUp(self): | 260 def setUp(self): |
261 super(GitRepositoryTest, self).setUp() | 261 super(GitRepositoryTest, self).setUp() |
262 self.http_client_for_git = self.GetMockHttpClient() | 262 self.http_client_for_git = self.GetMockHttpClient() |
263 self.repo_url = 'https://repo.test' | 263 self.repo_url = 'https://repo.test' |
264 self.git_repo = gitiles_repository.GitilesRepository( | 264 self.git_repo = gitiles_repository.GitilesRepository( |
265 self.http_client_for_git, self.repo_url) | 265 self.http_client_for_git, self.repo_url) |
266 | 266 |
267 def testGitRepositoryPropertySetters(self): | |
268 git_repo = gitiles_repository.GitilesRepository(self.http_client_for_git) | |
269 git_repo.repo_url = 'https://repo' | |
270 self.assertEqual(git_repo.repo_url, 'https://repo') | |
271 self.assertEqual(git_repo.http_client, self.http_client_for_git) | |
272 self.assertEqual(git_repo.identifier, 'https://repo') | |
273 | |
274 def testEndingSlashInRepoUrl(self): | 267 def testEndingSlashInRepoUrl(self): |
275 git_repo1 = gitiles_repository.GitilesRepository( | 268 git_repo1 = gitiles_repository.GitilesRepository( |
276 self.http_client_for_git, self.repo_url) | 269 self.http_client_for_git, self.repo_url) |
277 self.assertEqual(self.repo_url, git_repo1.repo_url) | 270 self.assertEqual(self.repo_url, git_repo1.repo_url) |
278 | 271 |
279 git_repo2 = gitiles_repository.GitilesRepository( | 272 git_repo2 = gitiles_repository.GitilesRepository( |
280 self.http_client_for_git, '%s/' % self.repo_url) | 273 self.http_client_for_git, '%s/' % self.repo_url) |
281 self.assertEqual(self.repo_url, git_repo2.repo_url) | 274 self.assertEqual(self.repo_url, git_repo2.repo_url) |
282 | 275 |
283 def testMalformattedJsonReponse(self): | 276 def testMalformattedJsonReponse(self): |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 '_SendRequestForJsonResponse', _MockSendRequestForJsonResponse) | 434 '_SendRequestForJsonResponse', _MockSendRequestForJsonResponse) |
442 | 435 |
443 changelogs = self.git_repo.GetChangeLogs('0', '2') | 436 changelogs = self.git_repo.GetChangeLogs('0', '2') |
444 | 437 |
445 self.assertEqual(len(changelogs), 2) | 438 self.assertEqual(len(changelogs), 2) |
446 | 439 |
447 def testGetWrappedGitRepositoryClass(self): | 440 def testGetWrappedGitRepositoryClass(self): |
448 repo = gitiles_repository.GitilesRepository( | 441 repo = gitiles_repository.GitilesRepository( |
449 self.http_client_for_git, 'http://repo_url') | 442 self.http_client_for_git, 'http://repo_url') |
450 self.assertEqual(repo.repo_url, 'http://repo_url') | 443 self.assertEqual(repo.repo_url, 'http://repo_url') |
OLD | NEW |