def test_config_simple2(self): git1 = PathSpec('foo', 'git', 'git/uri') svn1 = PathSpec('foos', 'svn', 'svn/uri') hg1 = PathSpec('fooh', 'hg', 'hg/uri') bzr1 = PathSpec('foob', 'bzr', 'bzr/uri') config = self._get_mock_config([git1, svn1, hg1, bzr1]) self.assertEqual(4, len(config.get_config_elements())) self.assertEqual('foo', config.get_config_elements()[0].get_local_name()) self.assertEqual('/install/path/foo', config.get_config_elements()[0].get_path()) self.assertEqual('git', config.get_source()[0].get_scmtype()) self.assertEqual('/install/path/git/uri', config.get_source()[0].get_uri()) self.assertEqual('svn', config.get_source()[1].get_scmtype()) self.assertEqual('/install/path/svn/uri', config.get_source()[1].get_uri()) self.assertEqual('hg', config.get_source()[2].get_scmtype()) self.assertEqual('/install/path/hg/uri', config.get_source()[2].get_uri()) self.assertEqual('bzr', config.get_source()[3].get_scmtype()) self.assertEqual('/install/path/bzr/uri', config.get_source()[3].get_uri())
def test_config_merging_replace(self): git1 = PathSpec('foo', 'git', 'git/uri') svn1 = PathSpec('foo', 'svn', 'svn/uri') hg1 = PathSpec('foo', 'hg', 'hg/uri') bzr1 = PathSpec('foo', 'bzr', 'bzr/uri') config = self._get_mock_config([git1, svn1, hg1, bzr1], merge_strategy="MergeReplace") self.assertEqual(1, len(config.get_config_elements())) self.assertEqual('bzr', config.get_source()[0].get_scmtype()) self.assertEqual('/install/path/bzr/uri', config.get_source()[0].get_uri()) config = self._get_mock_config([git1, svn1, hg1, bzr1, git1], merge_strategy="MergeReplace") self.assertEqual(1, len(config.get_config_elements())) self.assertEqual('git', config.get_source()[0].get_scmtype()) self.assertEqual('/install/path/git/uri', config.get_source()[0].get_uri()) bzr1 = PathSpec('bar', 'bzr', 'bzr/uri') config = self._get_mock_config([git1, svn1, hg1, bzr1], merge_strategy="MergeReplace") self.assertEqual(2, len(config.get_config_elements())) self.assertEqual('hg', config.get_source()[0].get_scmtype()) self.assertEqual('/install/path/hg/uri', config.get_source()[0].get_uri()) self.assertEqual('bzr', config.get_source()[1].get_scmtype()) self.assertEqual('/install/path/bzr/uri', config.get_source()[1].get_uri()) config = self._get_mock_config([git1, svn1, hg1, bzr1, git1], merge_strategy="MergeReplace") self.assertEqual(2, len(config.get_config_elements())) self.assertEqual('git', config.get_source()[0].get_scmtype()) self.assertEqual('/install/path/git/uri', config.get_source()[0].get_uri()) self.assertEqual('bzr', config.get_source()[1].get_scmtype()) self.assertEqual('/install/path/bzr/uri', config.get_source()[1].get_uri())