Ejemplo n.º 1
0
 def test_list_filter_query_builder(self):
     plugin1 = {'package_name': 'a', 'package_version': '1'}
     plugin2 = {'package_name': 'a',
                'package_version': '1',
                'distribution': 'c',
                'distribution_version': 'd',
                'distribution_release': 'e',
                'supported_platform': 'f'}
     for plugin in [plugin1, plugin2]:
         with _patch_client(plugins=[]) as client:
             installer.get_managed_plugin(plugin)
             self.assertEqual(plugin, client.plugins.kwargs)
Ejemplo n.º 2
0
 def test_list_filter_query_builder(self):
     plugin1 = {'package_name': 'a', 'package_version': '1'}
     plugin2 = {'package_name': 'a',
                'package_version': '1',
                'distribution': 'c',
                'distribution_version': 'd',
                'distribution_release': 'e',
                'supported_platform': 'f'}
     for plugin in [plugin1, plugin2]:
         with _patch_client(plugins=[]) as client:
             installer.get_managed_plugin(plugin)
             self.assertEqual(plugin, client.plugins.kwargs)
Ejemplo n.º 3
0
def test_implicit_supported_platform():
    plugins = [
        {
            'id': '1',
            'package_version': '1'
        },
        {
            'id': '2',
            'package_version': '1'
        },
        {
            'id': '3',
            'package_version': '1',
            'supported_platform': wagon.get_platform()
        },
        {
            'id': '4',
            'package_version': '1'
        },
        {
            'id': '5',
            'package_version': '1'
        },
    ]
    plugin = {
        'package_name': 'plugin',
        'distribution': 'x',
        'distribution_release': 'x',
        'package_version': '1'
    }
    with _patch_client(plugins=plugins):
        assert '3' == installer.get_managed_plugin(plugin=plugin).id
Ejemplo n.º 4
0
 def test_implicit_dist_and_dist_release(self):
     dist, _, dist_release = platform.linux_distribution(
         full_distribution_name=False)
     dist, dist_release = dist.lower(), dist_release.lower()
     plugins = [
         {
             'id': '1'
         },
         {
             'id': '2'
         },
         {
             'id': '3'
         },
         {
             'id': '4',
             'distribution': dist,
             'distribution_release': dist_release
         },
         {
             'id': '5'
         },
     ]
     plugin = {
         'package_name': 'plugin',
         'supported_platform': 'x',
         'package_version': '1'
     }
     with _patch_client(plugins=plugins):
         self.assertEquals('4',
                           installer.get_managed_plugin(plugin=plugin).id)
Ejemplo n.º 5
0
 def test_implicit_dist_and_dist_release(self):
     if os.name == 'nt':
         self.skipTest('Linux only test')
     dist, _, dist_release = platform.linux_distribution(
         full_distribution_name=False)
     dist, dist_release = dist.lower(), dist_release.lower()
     plugins = [
         {
             'id': '1'
         },
         {
             'id': '2'
         },
         {
             'id': '3'
         },
         {
             'id': '4',
             'distribution': dist,
             'distribution_release': dist_release
         },
         {
             'id': '5'
         },
     ]
     plugin = {'package_name': 'plugin', 'supported_platform': 'x'}
     with self._patch(plugins=plugins):
         self.assertEquals('4',
                           installer.get_managed_plugin(plugin=plugin).id)
Ejemplo n.º 6
0
 def test_implicit_supported_platform(self):
     plugins = [
         {
             'id': '1'
         },
         {
             'id': '2'
         },
         {
             'id': '3',
             'supported_platform': wagon_utils.get_platform()
         },
         {
             'id': '4'
         },
         {
             'id': '5'
         },
     ]
     plugin = {
         'package_name': 'plugin',
         'distribution': 'x',
         'distribution_release': 'x'
     }
     with self._patch(plugins=plugins):
         self.assertEquals('3',
                           installer.get_managed_plugin(plugin=plugin).id)
Ejemplo n.º 7
0
 def test_last_version_selection(self):
     plugins = [
         {
             'id': '1',
             'package_version': '1'
         },
         {
             'id': '2',
             'package_version': '3.5a1'
         },
         {
             'id': '3',
             'package_version': '2.2b1'
         },
         {
             'id': '4',
             'package_version': '1.2c1'
         },
         {
             'id': '5',
             'package_version': '3.4d2'
         },
     ]
     for p in plugins:
         p['supported_platform'] = 'any'
     plugin = {'package_name': 'plugin'}
     with self._patch(plugins=plugins):
         self.assertEquals('2',
                           installer.get_managed_plugin(plugin=plugin).id)
Ejemplo n.º 8
0
 def test_last_version_selection(self):
     plugins = [
         {'id': '1', 'package_version': '1'},
         {'id': '2', 'package_version': '3.5a1'},
         {'id': '3', 'package_version': '2.2b1'},
         {'id': '4', 'package_version': '1.2c1'},
         {'id': '5', 'package_version': '3.4d2'},
     ]
     for p in plugins:
         p['supported_platform'] = 'any'
     plugin = {'package_name': 'plugin'}
     with self._patch(plugins=plugins):
         self.assertEquals('2',
                           installer.get_managed_plugin(plugin=plugin).id)
Ejemplo n.º 9
0
 def test_implicit_supported_platform(self):
     plugins = [
         {'id': '1'},
         {'id': '2'},
         {'id': '3',
          'supported_platform': wagon_utils.get_platform()},
         {'id': '4'},
         {'id': '5'},
     ]
     plugin = {'package_name': 'plugin', 'distribution': 'x',
               'distribution_release': 'x'}
     with self._patch(plugins=plugins):
         self.assertEquals('3',
                           installer.get_managed_plugin(plugin=plugin).id)
Ejemplo n.º 10
0
 def test_implicit_dist_and_dist_release(self):
     dist, _, dist_release = platform.linux_distribution(
         full_distribution_name=False)
     dist, dist_release = dist.lower(), dist_release.lower()
     plugins = [
         {'id': '1'},
         {'id': '2'},
         {'id': '3'},
         {'id': '4',
          'distribution': dist, 'distribution_release': dist_release},
         {'id': '5'},
     ]
     plugin = {'package_name': 'plugin', 'supported_platform': 'x',
               'package_version': '1'}
     with _patch_client(plugins=plugins):
         self.assertEquals('4',
                           installer.get_managed_plugin(plugin=plugin).id)
Ejemplo n.º 11
0
 def test_implicit_dist_and_dist_release(self):
     if os.name == 'nt':
         self.skipTest('Linux only test')
     dist, _, dist_release = platform.linux_distribution(
         full_distribution_name=False)
     dist, dist_release = dist.lower(), dist_release.lower()
     plugins = [
         {'id': '1'},
         {'id': '2'},
         {'id': '3'},
         {'id': '4',
          'distribution': dist, 'distribution_release': dist_release},
         {'id': '5'},
     ]
     plugin = {'package_name': 'plugin', 'supported_platform': 'x'}
     with self._patch(plugins=plugins):
         self.assertEquals('4',
                           installer.get_managed_plugin(plugin=plugin).id)
Ejemplo n.º 12
0
 def test_no_package_name(self):
     with _patch_client(plugins=[]) as client:
         self.assertIsNone(installer.get_managed_plugin(plugin={}))
         self.assertIsNone(client.plugins.kwargs)
Ejemplo n.º 13
0
def test_no_managed_plugins():
    plugin = {'package_name': 'p', 'package_version': '1'}
    with _patch_client(plugins=[]) as client:
        assert installer.get_managed_plugin(plugin=plugin) is None
        assert plugin == client.plugins.kwargs
Ejemplo n.º 14
0
def test_no_package_name():
    with _patch_client(plugins=[]) as client:
        assert installer.get_managed_plugin(plugin={}) is None
        assert client.plugins.kwargs is None
Ejemplo n.º 15
0
 def test_no_managed_plugins(self):
     plugin = {'package_name': 'p', 'package_version': '1'}
     with _patch_client(plugins=[]) as client:
         self.assertIsNone(installer.get_managed_plugin(plugin=plugin))
         self.assertEqual(plugin, client.plugins.kwargs)
Ejemplo n.º 16
0
 def test_no_package_name(self):
     with _patch_client(plugins=[]) as client:
         self.assertIsNone(installer.get_managed_plugin(plugin={}))
         self.assertIsNone(client.plugins.kwargs)
Ejemplo n.º 17
0
 def test_no_managed_plugins(self):
     plugin = {'package_name': 'p', 'package_version': '1'}
     with _patch_client(plugins=[]) as client:
         self.assertIsNone(installer.get_managed_plugin(plugin=plugin))
         self.assertEqual(plugin, client.plugins.kwargs)