Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
from unittest import mock
import mozunit
import pytest
from mozversioncontrol import get_repository_object
STEPS = {
"hg": [],
"git": [
"""
""",
],
"jj": [],
}
@pytest.mark.parametrize(
"is_cinnabar,expected_remotes",
(
(
True,
[
"--remotes=central",
"--remotes=firefox",
"--remotes=unified",
],
),
(False, ["--remotes=firefox"]),
),
)
def test_get_mozilla_remote_args(is_cinnabar, expected_remotes, repo):
# Test is only relevant for Git.
if not repo.vcs == "git":
return
repo.execute_next_step()
vcs = get_repository_object(repo.dir)
vcs.is_cinnabar_repo = mock.MagicMock(name="is_cinnabar_repo")
vcs.is_cinnabar_repo.return_value = is_cinnabar
remotes = vcs.get_mozilla_remote_args()
assert remotes == [
"--remotes"
], "Default `--remotes` passed without finding official remote."
repo.execute_next_step()
remotes = sorted(vcs.get_mozilla_remote_args())
assert (
remotes == expected_remotes
), "Multiple non-try remote arguments should be found."
if __name__ == "__main__":
mozunit.main()