def test_get_version_from_package_error(self): with patch('apsconnectcli.apsconnect.pkg_resources') as pkg_mock, \ patch('apsconnectcli.apsconnect.bin_version') as bin_mock: bin_mock.return_value = 'v100500' pkg_mock.DistributionNotFound = DistributionNotFound pkg_mock.get_distribution.side_effect = DistributionNotFound() result = get_version() self.assertEqual(result, 'v100500')
def test_get_version_from_package_ok(self): with patch('apsconnectcli.apsconnect.pkg_resources') as pkg_mock: pkg_mock.get_distribution.return_value.version = 'v100500' result = get_version() self.assertEqual(result, 'v100500')