def test_getters_empty(self): data = {'vcs': 'svn', 'vcs_uri': 'https://code.ros.org/svn/ros-pkg'} self.assertEqual('', locate.get_www(None, data, None)) self.assertEqual('', locate.get_repo(None, data, None)) self.assertEqual('https://code.ros.org/svn/ros-pkg', locate.get_vcs_uri_for_branch(data)) self.assertEqual('https://code.ros.org/svn/ros-pkg', locate.get_vcs_uri_for_branch(data, 'release')) self.assertEqual('https://code.ros.org/svn/ros-pkg', locate.get_vcs_uri_for_branch(data, 'devel')) self.assertEqual('svn', locate.get_vcs(None, data, None)) self.assertEqual('- svn:\n local-name: myname\n uri: https://code.ros.org/svn/ros-pkg\n', locate.get_rosinstall('myname', data, 'mytype')) self.assertEqual('- svn:\n local-name: myname\n uri: https://code.ros.org/svn/ros-pkg\n', locate.get_rosinstall('myname', data, 'mytype', 'devel')) self.assertEqual('- svn:\n local-name: myname\n uri: https://code.ros.org/svn/ros-pkg\n', locate.get_rosinstall('myname', data, 'mytype', 'release')) self.assertEqual('- svn:\n local-name: foo/myname\n uri: https://code.ros.org/svn/ros-pkg\n', locate.get_rosinstall('myname', data, 'mytype', None, 'foo')) self.assertEqual('https://code.ros.org/svn/ros-pkg', locate.get_vcs_uri(data)) self.assertEqual('', locate.get_vcs_version(data)) self.assertEqual('package', locate.get_type(data))
def test_get_with_branches(self): data = { 'rosinstalls': { 'devel': { 'hg': { 'local-name': 'navigation', 'uri': 'https://kforge.ros.org/test/devel', 'version': 'navigation-1.6' } }, 'distro': { 'hg': { 'local-name': 'navigation', 'uri': 'https://kforge.ros.org/test/distro', 'version': 'electric' } }, 'release': { 'hg': { 'local-name': 'navigation', 'uri': 'https://kforge.ros.org/test/rel', 'version': 'navigation-1.6.5' } } }, 'vcs': 'svn', 'vcs_uri': 'https://code.ros.org/svn/ros-pkg' } self.assertEqual('https://code.ros.org/svn/ros-pkg', locate.get_vcs_uri_for_branch(data)) self.assertEqual('https://kforge.ros.org/test/rel', locate.get_vcs_uri_for_branch(data, 'release')) self.assertEqual('https://kforge.ros.org/test/devel', locate.get_vcs_uri_for_branch(data, 'devel')) self.assertEqual('https://kforge.ros.org/test/distro', locate.get_vcs_uri_for_branch(data, 'distro')) self.assertEqual('svn', locate.get_vcs(None, data, None)) self.assertEqual('https://code.ros.org/svn/ros-pkg', locate.get_vcs_uri(data)) self.assertEqual('', locate.get_vcs_version(data)) self.assertEqual('package', locate.get_type(data)) self.assertEqual( '- svn:\n local-name: myname\n uri: https://code.ros.org/svn/ros-pkg\n', locate.get_rosinstall('myname', data, 'mytype')) self.assertEqual( '- hg:\n local-name: navigation\n uri: https://kforge.ros.org/test/devel\n version: navigation-1.6\n', locate.get_rosinstall('myname', data, 'mytype', 'devel')) self.assertEqual( '- hg:\n local-name: navigation\n uri: https://kforge.ros.org/test/rel\n version: navigation-1.6.5\n', locate.get_rosinstall('myname', data, 'mytype', 'release')) self.assertEqual( '- svn:\n local-name: foo/myname\n uri: https://code.ros.org/svn/ros-pkg\n', locate.get_rosinstall('myname', data, 'mytype', None, 'foo'))
def test_get_with_branches(self): data = { 'rosinstalls': {'devel': {'hg': {'local-name': 'navigation', 'uri': 'https://kforge.ros.org/test/devel', 'version': 'navigation-1.6'}}, 'distro': {'hg': {'local-name': 'navigation', 'uri': 'https://kforge.ros.org/test/distro', 'version': 'electric'}}, 'release': {'hg': {'local-name': 'navigation', 'uri': 'https://kforge.ros.org/test/rel', 'version': 'navigation-1.6.5'}}}, 'vcs': 'svn', 'vcs_uri': 'https://code.ros.org/svn/ros-pkg'} self.assertEqual('https://code.ros.org/svn/ros-pkg', locate.get_vcs_uri_for_branch(data)) self.assertEqual('https://kforge.ros.org/test/rel', locate.get_vcs_uri_for_branch(data, 'release')) self.assertEqual('https://kforge.ros.org/test/devel', locate.get_vcs_uri_for_branch(data, 'devel')) self.assertEqual('https://kforge.ros.org/test/distro', locate.get_vcs_uri_for_branch(data, 'distro')) self.assertEqual('svn', locate.get_vcs(None, data, None)) self.assertEqual('https://code.ros.org/svn/ros-pkg', locate.get_vcs_uri(data)) self.assertEqual('', locate.get_vcs_version(data)) self.assertEqual('package', locate.get_type(data)) self.assertEqual( '- svn:\n local-name: myname\n uri: https://code.ros.org/svn/ros-pkg\n', locate.get_rosinstall('myname', data, 'mytype')) self.assertEqual( '- hg:\n local-name: navigation\n uri: https://kforge.ros.org/test/devel\n version: navigation-1.6\n', locate.get_rosinstall('myname', data, 'mytype', 'devel')) self.assertEqual( '- hg:\n local-name: navigation\n uri: https://kforge.ros.org/test/rel\n version: navigation-1.6.5\n', locate.get_rosinstall('myname', data, 'mytype', 'release')) self.assertEqual( '- svn:\n local-name: foo/myname\n uri: https://code.ros.org/svn/ros-pkg\n', locate.get_rosinstall('myname', data, 'mytype', None, 'foo'))