summaryrefslogtreecommitdiffstats
path: root/python/mozversioncontrol/test/test_get_upstream_remotes.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/mozversioncontrol/test/test_get_upstream_remotes.py')
-rw-r--r--python/mozversioncontrol/test/test_get_upstream_remotes.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/python/mozversioncontrol/test/test_get_upstream_remotes.py b/python/mozversioncontrol/test/test_get_upstream_remotes.py
new file mode 100644
index 0000000000..d1a4727ec3
--- /dev/null
+++ b/python/mozversioncontrol/test/test_get_upstream_remotes.py
@@ -0,0 +1,45 @@
+# 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
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import mozunit
+
+from mozversioncontrol import get_repository_object
+
+STEPS = {
+ "hg": [],
+ "git": [
+ "git remote add blah https://example.com/blah",
+ """
+ git remote add unified hg::https://hg.mozilla.org/mozilla-unified
+ git remote add central hg::https://hg.mozilla.org/central
+ git remote add try hg::https://hg.mozilla.org/try
+ """,
+ ],
+}
+
+
+def test_get_upstream_remotes(repo):
+ # Test is only relevant for Git.
+ if not repo.vcs == "git":
+ return
+
+ repo.execute_next_step()
+
+ vcs = get_repository_object(repo.dir)
+ remotes = vcs.get_mozilla_upstream_remotes()
+
+ assert list(remotes) == [], "No official remotes should be found."
+
+ repo.execute_next_step()
+
+ remotes = sorted(list(vcs.get_mozilla_upstream_remotes()))
+
+ assert remotes == [
+ "central",
+ "unified",
+ ], "Multiple non-try remotes should be found."
+
+
+if __name__ == "__main__":
+ mozunit.main()