Esempio n. 1
0
 def test_load_config(self):
     global_config = EasyUpgrade.load_yaml(self.YML_CONFIG_PATH)
     provider = SimpleProvider(global_config)
     self.assertEqual(provider.key1, 'value1')
     self.assertEqual(provider.get('key1'), 'value1')
     self.assertEqual(len(provider.releases), 1)
     release = provider.releases.values()[0]
     self.assertIsNotNone(release)
     self.assertEqual(release.name, 'cogniteev/docido')
     self.assertEqual(release.get('key2'), 'value2')
     self.assertIsNotNone(release.fetcher)
     self.assertEqual(release.fetcher.name, 'fetch1')
     self.assertEqual(release.fetcher.get('key3'), 'value3')
     self.assertIsNotNone(release.installer)
     self.assertEqual(release.installer.name, 'install1')
     self.assertEqual(release.installer.get('key4'), 'value4')
     self.assertIsNotNone(release.post_installers)
     self.assertEqual(len(release.post_installers), 3)
     pi1 = release.post_installers[0]
     self.assertEqual(pi1.name, 'post-installer1')
     self.assertEqual(pi1.get('key5'), 'value5')
     pi2 = release.post_installers[1]
     self.assertEqual(pi2.name, 'post-installer1')
     self.assertEqual(pi2.get('key6'), 'value6')
     pi3 = release.post_installers[2]
     self.assertEqual(pi3.name, 'post-installer2')
     self.assertEqual(pi3.get('key7'), 'value7')
Esempio n. 2
0
 def test_installation(self):
     global_config = EasyUpgrade.load_yaml(self.YML_CONFIG_PATH)
     provider = SimpleProvider(global_config)
     release = provider.releases.values()[0]
     release.post_installers[2].ut = self
     self.assertTrue(provider.install('cogniteev/docido'))
     self.assertFalse(provider.install('cogniteev/docido'))
Esempio n. 3
0
 def test_install_compose_only(self):
     if osp.isdir(self.stow_root_dir):
         shutil.rmtree(self.stow_root_dir)
     eu = EasyUpgrade.from_yaml(self.YAML_CONFIG_FILE)
     eu.providers['github'].install('docker/compose')
     compose_executable = osp.join(
         self.stow_root_dir,
         'stow',
         'compose-1.3.3',
         'bin',
         'docker-compose'
     )
     self.assertTrue(osp.isfile(compose_executable))
Esempio n. 4
0
 def test_outdated_packages(self):
     if osp.isdir(self.stow_root_dir):
         shutil.rmtree(self.stow_root_dir)
     eu = EasyUpgrade.from_yaml(self.YAML_CONFIG_FILE)
     outdated = list(eu.get_outdated_packages())
     self.assertEqual(len(outdated), 2)
     expected = [
         {
             'release': 'docker/machine',
             'provider': 'github',
             'versions': {
                 'candidate': {
                     'human': u'v0.3.1',
                     'tuple': (
                         u'00000000', u'00000003',
                         u'00000001', '*final'
                     )
                 }
             }
         },
         {
             'release': 'docker/compose',
             'provider': 'github',
             'versions': {
                 'candidate': {
                     'human': u'1.3.3',
                     'tuple': (
                         u'00000001', u'00000003',
                         u'00000003', '*final'
                     )
                 }
             }
         }
     ]
     for o in outdated:
         self.assertIn(o, expected)
     for e in expected:
         self.assertIn(e, outdated)