Ejemplo n.º 1
0
 def test_file_not_found(self):
     # A ValueError is raised if the hosted file cannot be found.
     project = AttrDict(
         series=[
             AttrDict(
                 name='stable',
                 releases=[AttrDict(version='0.1.0', files=[])],
             ),
         ],
     )
     with self.assertRaises(ValueError) as cm:
         get_launchpad_release(project, 'stable', None)
     self.assertIn('file not found', str(cm.exception))
Ejemplo n.º 2
0
 def test_specific_trunk_release(self):
     # Ensure the correct URL is returned for a specific version of the
     # trunk release.
     url, name = get_launchpad_release(
         self.project, 'trunk', '0.1.0+build.1')
     self.assertEqual('http://example.com/0.1.0+build.1.tgz', url)
     self.assertEqual('0.1.0+build.1.tgz', name)
Ejemplo n.º 3
0
 def test_xz_files_are_found(self):
     project = AttrDict(
         series=[
             AttrDict(
                 name='stable',
                 releases=[
                     AttrDict(
                         version='0.1.0',
                         files=[FileStub('http://example.com/0.1.0.xz')],
                     ),
                 ],
             ),
         ],
     )
     url, name = get_launchpad_release(project, 'stable', None)
     self.assertEqual('http://example.com/0.1.0.xz', url)
     self.assertEqual('0.1.0.xz', name)
Ejemplo n.º 4
0
 def test_file_not_found_in_latest_release(self):
     # The URL of a file from a previous release is returned if the latest
     # one does not contain tarballs.
     project = AttrDict(
         series=[
             AttrDict(
                 name='stable',
                 releases=[
                     AttrDict(version='0.1.1', files=[]),
                     AttrDict(
                         version='0.1.0',
                         files=[FileStub('http://example.com/0.1.0.tgz')],
                     ),
                 ],
             ),
         ],
     )
     url, name = get_launchpad_release(project, 'stable', None)
     self.assertEqual('http://example.com/0.1.0.tgz', url)
     self.assertEqual('0.1.0.tgz', name)
Ejemplo n.º 5
0
 def test_release_not_found(self):
     # A ValueError is raised if the release cannot be found.
     with self.assertRaises(ValueError) as cm:
         get_launchpad_release(self.project, 'stable', '2.0')
     self.assertIn('release not found', str(cm.exception))
Ejemplo n.º 6
0
 def test_no_releases(self):
     # A ValueError is raised if the series does not contain releases.
     project = AttrDict(series=[AttrDict(name='stable', releases=[])])
     with self.assertRaises(ValueError) as cm:
         get_launchpad_release(project, 'stable', None)
     self.assertIn('series does not contain releases', str(cm.exception))
Ejemplo n.º 7
0
 def test_series_not_found(self):
     # A ValueError is raised if the series cannot be found.
     with self.assertRaises(ValueError) as cm:
         get_launchpad_release(self.project, 'unstable', None)
     self.assertIn('series not found', str(cm.exception))
Ejemplo n.º 8
0
 def test_specific_stable_release(self):
     # Ensure the correct URL is returned for a specific version of the
     # stable release.
     url, name = get_launchpad_release(self.project, 'stable', '0.1.0')
     self.assertEqual('http://example.com/0.1.0.tgz', url)
     self.assertEqual('0.1.0.tgz', name)
Ejemplo n.º 9
0
 def test_latest_trunk_release(self):
     # Ensure the correct URL is returned for the latest trunk release.
     url, name = get_launchpad_release(self.project, 'trunk', None)
     self.assertEqual('http://example.com/0.1.1+build.1.tgz', url)
     self.assertEqual('0.1.1+build.1.tgz', name)
Ejemplo n.º 10
0
 def test_latest_stable_release(self):
     # Ensure the correct URL is returned for the latest stable release.
     url, name = get_launchpad_release(self.project, 'stable', None)
     self.assertEqual('http://example.com/0.1.1.tgz', url)
     self.assertEqual('0.1.1.tgz', name)