##// END OF EJS Templates
tests: Add new argument to tests using '_create_files_url' method.
Martin Bornhold -
r459:8edff3d1 default
parent child Browse files
Show More
@@ -407,31 +407,33 b' class TestCreateFilesUrl(object):'
407 controller = summary.SummaryController()
407 controller = summary.SummaryController()
408 repo = mock.Mock()
408 repo = mock.Mock()
409 repo.name = 'abcde'
409 repo.name = 'abcde'
410 full_repo_name = 'test-repo-group/' + repo.name
410 ref_name = 'branch1'
411 ref_name = 'branch1'
411 raw_id = 'deadbeef0123456789'
412 raw_id = 'deadbeef0123456789'
412 is_svn = False
413 is_svn = False
413
414
414 with mock.patch.object(summary.h, 'url') as url_mock:
415 with mock.patch.object(summary.h, 'url') as url_mock:
415 result = controller._create_files_url(
416 result = controller._create_files_url(
416 repo, ref_name, raw_id, is_svn)
417 repo, full_repo_name, ref_name, raw_id, is_svn)
417 url_mock.assert_called_once_with(
418 url_mock.assert_called_once_with(
418 'files_home', repo_name=repo.name, f_path='', revision=ref_name,
419 'files_home', repo_name=full_repo_name, f_path='',
419 at=ref_name)
420 revision=ref_name, at=ref_name)
420 assert result == url_mock.return_value
421 assert result == url_mock.return_value
421
422
422 def test_creates_svn_url(self):
423 def test_creates_svn_url(self):
423 controller = summary.SummaryController()
424 controller = summary.SummaryController()
424 repo = mock.Mock()
425 repo = mock.Mock()
425 repo.name = 'abcde'
426 repo.name = 'abcde'
427 full_repo_name = 'test-repo-group/' + repo.name
426 ref_name = 'branch1'
428 ref_name = 'branch1'
427 raw_id = 'deadbeef0123456789'
429 raw_id = 'deadbeef0123456789'
428 is_svn = True
430 is_svn = True
429
431
430 with mock.patch.object(summary.h, 'url') as url_mock:
432 with mock.patch.object(summary.h, 'url') as url_mock:
431 result = controller._create_files_url(
433 result = controller._create_files_url(
432 repo, ref_name, raw_id, is_svn)
434 repo, full_repo_name, ref_name, raw_id, is_svn)
433 url_mock.assert_called_once_with(
435 url_mock.assert_called_once_with(
434 'files_home', repo_name=repo.name, f_path=ref_name,
436 'files_home', repo_name=full_repo_name, f_path=ref_name,
435 revision=raw_id, at=ref_name)
437 revision=raw_id, at=ref_name)
436 assert result == url_mock.return_value
438 assert result == url_mock.return_value
437
439
@@ -439,15 +441,16 b' class TestCreateFilesUrl(object):'
439 controller = summary.SummaryController()
441 controller = summary.SummaryController()
440 repo = mock.Mock()
442 repo = mock.Mock()
441 repo.name = 'abcde'
443 repo.name = 'abcde'
444 full_repo_name = 'test-repo-group/' + repo.name
442 ref_name = 'branch1/branch2'
445 ref_name = 'branch1/branch2'
443 raw_id = 'deadbeef0123456789'
446 raw_id = 'deadbeef0123456789'
444 is_svn = False
447 is_svn = False
445
448
446 with mock.patch.object(summary.h, 'url') as url_mock:
449 with mock.patch.object(summary.h, 'url') as url_mock:
447 result = controller._create_files_url(
450 result = controller._create_files_url(
448 repo, ref_name, raw_id, is_svn)
451 repo, full_repo_name, ref_name, raw_id, is_svn)
449 url_mock.assert_called_once_with(
452 url_mock.assert_called_once_with(
450 'files_home', repo_name=repo.name, f_path='', revision=raw_id,
453 'files_home', repo_name=full_repo_name, f_path='', revision=raw_id,
451 at=ref_name)
454 at=ref_name)
452 assert result == url_mock.return_value
455 assert result == url_mock.return_value
453
456
General Comments 0
You need to be logged in to leave comments. Login now