def test_get_latest_version(self): httpretty.enable() # enable HTTPretty so that it will monkey patch the socket module httpretty.register_uri(httpretty.GET, "https://localhost/api/v3/projects/web-jenkins-jobs%2Funit-tests-codeception/repository/tags?private_token=123456", body=self.get_gitlab_responnse(), status=200) gitlab = Download(self.get_data()) gitlab.get_latest_version("unit-tests-codeception", "v1.*") is "v1.1.1"
def test_get_latest_version_no_version_exception(self): httpretty.enable() # enable HTTPretty so that it will monkey patch the socket module httpretty.register_uri(httpretty.GET, "https://localhost/api/v3/projects/web-jenkins-jobs%2Funit-tests-codeception/repository/tags?private_token=123456", body="{}", status=200) gitlab = Download(self.get_data()) with pytest.raises(Exception) as inst: gitlab.get_latest_version("unit-tests-codeception", "v2.*") assert str(inst.value) == "No matching version for unit-tests-codeception v2.*."