예제 #1
0
 def test_install_or_update_local(self):
     """Test calling install_or_update with a local skill"""
     skill = self._build_mock_msm_skill_list()
     updater = SkillUpdater(self.message_bus_mock)
     updater.install_or_update(skill)
     self.assertIn('foobar', updater.installed_skills)
     skill.update.assert_called_once_with()
     skill.update_deps.assert_called_once_with()
     self.msm_mock.install.assert_not_called()
예제 #2
0
 def test_install_or_update_beta(self):
     """Test calling install_or_update with a beta skill."""
     self.msm_mock.device_skill_state['skills'][0]['beta'] = True
     skill = self._build_mock_msm_skill_list()
     skill.is_local = False
     updater = SkillUpdater(self.message_bus_mock)
     updater.install_or_update(skill)
     self.assertIn('foobar', updater.installed_skills)
     self.assertIsNone(skill.sha)
예제 #3
0
 def test_install_or_update_default(self):
     """Test calling install_or_update with a default skill"""
     skill = self._build_mock_msm_skill_list()
     skill.name = 'test_skill'
     skill.is_local = False
     updater = SkillUpdater(self.message_bus_mock)
     updater.install_or_update(skill)
     self.assertIn('test_skill', updater.installed_skills)
     self.assertTrue(not skill.update.called)
     self.msm_mock.install.assert_called_once_with(skill, origin='default')
예제 #4
0
 def test_install_or_update_default_fail(self):
     """Test calling install_or_update with a failed install result"""
     skill = self._build_mock_msm_skill_list()
     skill.name = 'test_skill'
     skill.is_local = False
     self.msm_mock.install.side_effect = ValueError
     updater = SkillUpdater(self.message_bus_mock)
     with self.assertRaises(ValueError):
         updater.install_or_update(skill)
     self.assertNotIn('test_skill', updater.installed_skills)
     self.assertTrue(not skill.update.called)
     self.msm_mock.install.assert_called_once_with(skill, origin='default')
     self.assertTrue(updater.default_skill_install_error)