def test_get_most_recent_release_no_results(self, session, response): from stac.http import VersionApiDao response.status_code = 404 response.url = 'https://www.example.com/artifactory/api/search/latestVersion' error = requests.HTTPError("Something bad", request=requests.Request(), response=response) response.raise_for_status.side_effect = error session.get.return_value = response http_client = VersionApiDao(session, 'https://www.example.com/artifactory', 'libs-release') with pytest.raises(requests.HTTPError): http_client.get_most_recent_release('com.example.services', 'mail')
def test_get_most_recent_release(self, session, response): from stac.http import VersionApiDao response.status_code = 200 response.text = '4.34.1\n' session.get.return_value = response http_client = VersionApiDao(session, 'https://www.example.com/artifactory', 'libs-release') version = http_client.get_most_recent_release('com.example.services', 'mail') assert '4.34.1' == version