def test_find_ubuntu_items(self): sku = Mock() sku.name = '16.04.3-LTS' bad_sku = Mock() bad_sku.name = '16.0q.3-LTS' client = Mock() client.virtual_machine_images.list_skus.return_value = [sku, bad_sku] client.config.base_url = 'http://example.com' location = Mock() location.name = 'canadaeast' items = find_ubuntu_items(client, [location]) self.assertEqual(items, [make_ubuntu_item( 'http://example.com', 'canadaeast', '16.04.3-LTS')])
def test_version(self): item = make_ubuntu_item('http://example.com', 'canadaeast', '16.04.5-LTS') self.assertEqual('16.04', item.data['version']) self.assertIn(':16.04:', item.product_name)
def test_xenial(self): item = make_ubuntu_item('http://example.com', 'canadaeast', '16.04.5-LTS') self.assertEqual('xenial', item.data['release'])
def test_not_a_version(self): item = make_ubuntu_item('http://example.com', 'canadaeast', '12.q.5') self.assertIs(item, None)
def test_unknown_tag(self): item = make_ubuntu_item('http://example.com', 'canadaeast', '12.04.5-FOOBAR') self.assertIs(item, None)
def test_daily_lts(self): item = make_ubuntu_item('http://example.com', 'canadaeast', '12.04.5-DAILY-LTS') self.assertEqual(item.content_id, 'com.ubuntu.cloud:daily:azure')
def test_no_lts(self): item = make_ubuntu_item('http://example.com', 'canadaeast', '12.04.5') self.assertEqual(item, self.make_item('12.04.5'))