def test_check_for_update(self, mock_get_distribution): mock_get_distribution.return_value.version = "0.1.0" check_for_update() self.assertEqual(mock_get_distribution.call_count, 1) mock_get_distribution.side_effect = TypeError("test") check_for_update() self.assertEqual(mock_get_distribution.call_count, 2)
def test_check_for_update(self, m_warning, m_info): check_for_update() m_warning.assert_called_once_with( "Unable to get version info!!, continuing") with mock.patch("taskcat._cli.get_pip_version") as m_curver: m_curver.return_value = "0.0.1" check_for_update() m_curver.assert_called_once()
def test_check_for_update_ver_is_sub_of_current( self, mock_upg_msg, mock_log, mock_get_installed, mock_get_pip ): # already latest mock_get_installed.return_value = "0.1.0" mock_get_pip.return_value = "0.1.0" check_for_update() mock_log.info.assert_called() mock_upg_msg.assert_not_called() # upgrade available mock_get_pip.return_value = "0.1.1" check_for_update() mock_upg_msg.assert_called_once()