diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_git_superproject.py | 2 | ||||
| -rw-r--r-- | tests/test_manifest_xml.py | 69 |
2 files changed, 70 insertions, 1 deletions
diff --git a/tests/test_git_superproject.py b/tests/test_git_superproject.py index e9b824d6..a24fc7f0 100644 --- a/tests/test_git_superproject.py +++ b/tests/test_git_superproject.py | |||
| @@ -157,7 +157,7 @@ class SuperprojectTestCase(unittest.TestCase): | |||
| 157 | """) | 157 | """) |
| 158 | self._superproject = git_superproject.Superproject(manifest, self.repodir, | 158 | self._superproject = git_superproject.Superproject(manifest, self.repodir, |
| 159 | self.git_event_log) | 159 | self.git_event_log) |
| 160 | with mock.patch.object(self._superproject, '_GetBranch', return_value='junk'): | 160 | with mock.patch.object(self._superproject, '_branch', 'junk'): |
| 161 | sync_result = self._superproject.Sync() | 161 | sync_result = self._superproject.Sync() |
| 162 | self.assertFalse(sync_result.success) | 162 | self.assertFalse(sync_result.success) |
| 163 | self.assertTrue(sync_result.fatal) | 163 | self.assertTrue(sync_result.fatal) |
diff --git a/tests/test_manifest_xml.py b/tests/test_manifest_xml.py index 20459d1d..ce422536 100644 --- a/tests/test_manifest_xml.py +++ b/tests/test_manifest_xml.py | |||
| @@ -572,6 +572,7 @@ class SuperProjectElementTests(ManifestParseTestCase): | |||
| 572 | self.assertEqual(manifest.superproject['name'], 'superproject') | 572 | self.assertEqual(manifest.superproject['name'], 'superproject') |
| 573 | self.assertEqual(manifest.superproject['remote'].name, 'test-remote') | 573 | self.assertEqual(manifest.superproject['remote'].name, 'test-remote') |
| 574 | self.assertEqual(manifest.superproject['remote'].url, 'http://localhost/superproject') | 574 | self.assertEqual(manifest.superproject['remote'].url, 'http://localhost/superproject') |
| 575 | self.assertEqual(manifest.superproject['revision'], 'refs/heads/main') | ||
| 575 | self.assertEqual( | 576 | self.assertEqual( |
| 576 | sort_attributes(manifest.ToXml().toxml()), | 577 | sort_attributes(manifest.ToXml().toxml()), |
| 577 | '<?xml version="1.0" ?><manifest>' | 578 | '<?xml version="1.0" ?><manifest>' |
| @@ -580,6 +581,72 @@ class SuperProjectElementTests(ManifestParseTestCase): | |||
| 580 | '<superproject name="superproject"/>' | 581 | '<superproject name="superproject"/>' |
| 581 | '</manifest>') | 582 | '</manifest>') |
| 582 | 583 | ||
| 584 | def test_superproject_revision(self): | ||
| 585 | """Check superproject settings with a different revision attribute""" | ||
| 586 | self.maxDiff = None | ||
| 587 | manifest = self.getXmlManifest(""" | ||
| 588 | <manifest> | ||
| 589 | <remote name="test-remote" fetch="http://localhost" /> | ||
| 590 | <default remote="test-remote" revision="refs/heads/main" /> | ||
| 591 | <superproject name="superproject" revision="refs/heads/stable" /> | ||
| 592 | </manifest> | ||
| 593 | """) | ||
| 594 | self.assertEqual(manifest.superproject['name'], 'superproject') | ||
| 595 | self.assertEqual(manifest.superproject['remote'].name, 'test-remote') | ||
| 596 | self.assertEqual(manifest.superproject['remote'].url, 'http://localhost/superproject') | ||
| 597 | self.assertEqual(manifest.superproject['revision'], 'refs/heads/stable') | ||
| 598 | self.assertEqual( | ||
| 599 | sort_attributes(manifest.ToXml().toxml()), | ||
| 600 | '<?xml version="1.0" ?><manifest>' | ||
| 601 | '<remote fetch="http://localhost" name="test-remote"/>' | ||
| 602 | '<default remote="test-remote" revision="refs/heads/main"/>' | ||
| 603 | '<superproject name="superproject" revision="refs/heads/stable"/>' | ||
| 604 | '</manifest>') | ||
| 605 | |||
| 606 | def test_superproject_revision_default_negative(self): | ||
| 607 | """Check superproject settings with a same revision attribute""" | ||
| 608 | self.maxDiff = None | ||
| 609 | manifest = self.getXmlManifest(""" | ||
| 610 | <manifest> | ||
| 611 | <remote name="test-remote" fetch="http://localhost" /> | ||
| 612 | <default remote="test-remote" revision="refs/heads/stable" /> | ||
| 613 | <superproject name="superproject" revision="refs/heads/stable" /> | ||
| 614 | </manifest> | ||
| 615 | """) | ||
| 616 | self.assertEqual(manifest.superproject['name'], 'superproject') | ||
| 617 | self.assertEqual(manifest.superproject['remote'].name, 'test-remote') | ||
| 618 | self.assertEqual(manifest.superproject['remote'].url, 'http://localhost/superproject') | ||
| 619 | self.assertEqual(manifest.superproject['revision'], 'refs/heads/stable') | ||
| 620 | self.assertEqual( | ||
| 621 | sort_attributes(manifest.ToXml().toxml()), | ||
| 622 | '<?xml version="1.0" ?><manifest>' | ||
| 623 | '<remote fetch="http://localhost" name="test-remote"/>' | ||
| 624 | '<default remote="test-remote" revision="refs/heads/stable"/>' | ||
| 625 | '<superproject name="superproject"/>' | ||
| 626 | '</manifest>') | ||
| 627 | |||
| 628 | def test_superproject_revision_remote(self): | ||
| 629 | """Check superproject settings with a same revision attribute""" | ||
| 630 | self.maxDiff = None | ||
| 631 | manifest = self.getXmlManifest(""" | ||
| 632 | <manifest> | ||
| 633 | <remote name="test-remote" fetch="http://localhost" revision="refs/heads/main" /> | ||
| 634 | <default remote="test-remote" /> | ||
| 635 | <superproject name="superproject" revision="refs/heads/stable" /> | ||
| 636 | </manifest> | ||
| 637 | """) | ||
| 638 | self.assertEqual(manifest.superproject['name'], 'superproject') | ||
| 639 | self.assertEqual(manifest.superproject['remote'].name, 'test-remote') | ||
| 640 | self.assertEqual(manifest.superproject['remote'].url, 'http://localhost/superproject') | ||
| 641 | self.assertEqual(manifest.superproject['revision'], 'refs/heads/stable') | ||
| 642 | self.assertEqual( | ||
| 643 | sort_attributes(manifest.ToXml().toxml()), | ||
| 644 | '<?xml version="1.0" ?><manifest>' | ||
| 645 | '<remote fetch="http://localhost" name="test-remote" revision="refs/heads/main"/>' | ||
| 646 | '<default remote="test-remote"/>' | ||
| 647 | '<superproject name="superproject" revision="refs/heads/stable"/>' | ||
| 648 | '</manifest>') | ||
| 649 | |||
| 583 | def test_remote(self): | 650 | def test_remote(self): |
| 584 | """Check superproject settings with a remote.""" | 651 | """Check superproject settings with a remote.""" |
| 585 | manifest = self.getXmlManifest(""" | 652 | manifest = self.getXmlManifest(""" |
| @@ -593,6 +660,7 @@ class SuperProjectElementTests(ManifestParseTestCase): | |||
| 593 | self.assertEqual(manifest.superproject['name'], 'platform/superproject') | 660 | self.assertEqual(manifest.superproject['name'], 'platform/superproject') |
| 594 | self.assertEqual(manifest.superproject['remote'].name, 'superproject-remote') | 661 | self.assertEqual(manifest.superproject['remote'].name, 'superproject-remote') |
| 595 | self.assertEqual(manifest.superproject['remote'].url, 'http://localhost/platform/superproject') | 662 | self.assertEqual(manifest.superproject['remote'].url, 'http://localhost/platform/superproject') |
| 663 | self.assertEqual(manifest.superproject['revision'], 'refs/heads/main') | ||
| 596 | self.assertEqual( | 664 | self.assertEqual( |
| 597 | sort_attributes(manifest.ToXml().toxml()), | 665 | sort_attributes(manifest.ToXml().toxml()), |
| 598 | '<?xml version="1.0" ?><manifest>' | 666 | '<?xml version="1.0" ?><manifest>' |
| @@ -613,6 +681,7 @@ class SuperProjectElementTests(ManifestParseTestCase): | |||
| 613 | """) | 681 | """) |
| 614 | self.assertEqual(manifest.superproject['name'], 'superproject') | 682 | self.assertEqual(manifest.superproject['name'], 'superproject') |
| 615 | self.assertEqual(manifest.superproject['remote'].name, 'default-remote') | 683 | self.assertEqual(manifest.superproject['remote'].name, 'default-remote') |
| 684 | self.assertEqual(manifest.superproject['revision'], 'refs/heads/main') | ||
| 616 | self.assertEqual( | 685 | self.assertEqual( |
| 617 | sort_attributes(manifest.ToXml().toxml()), | 686 | sort_attributes(manifest.ToXml().toxml()), |
| 618 | '<?xml version="1.0" ?><manifest>' | 687 | '<?xml version="1.0" ?><manifest>' |
