def should_serve_hashes(self, request): """When requested, the endpoint should serve the packages with hashes""" ret = package_versions(self.package3, request) self.assertEqual( ret, { "pkgs": { self.package3.filename: { "url": self.package3.get_url(request), "requires_python": None, "hash_sha256": "sha", "hash_md5": "md5", "non_hashed_url": self.package3.get_url(request), } } }, ) # Check the /json endpoint too ret = package_versions_json(self.package3, request) self.assertEqual( ret["releases"], { "2.1": [ { "filename": self.package3.filename, "packagetype": "sdist", "url": self.package.get_url(request), "md5_digest": "md5", "digests": {"sha256": "sha", "md5": "md5"}, "requires_python": None, } ] }, )
def should_base_json_redirect(self, request): """When requested, the endpoint should redirect to the fallback""" ret = package_versions_json(self.package, request) self.assertEqual(ret.status_code, 302) self.assertEqual( ret.location, self.fallback_base_url.rstrip("/") + request.path )
def should_base_json_redirect(self, request): """ When requested, the endpoint should redirect to the fallback """ ret = package_versions_json(self.package, request) self.assertEqual(ret.status_code, 302) self.assertEqual( ret.location, self.fallback_base_url.rstrip("/") + request.path )
def should_serve(self, request): """ When requested, the endpoint should serve the packages """ ret = package_versions(self.package, request) self.assertEqual( ret, { "pkgs": { self.package.filename: { "url": self.package.get_url(request), "requires_python": None, } } }, ) # Check the /json endpoint too ret = package_versions_json(self.package, request) self.assertEqual( ret["releases"], { "1.1": [{ "filename": self.package.filename, "url": self.package.get_url(request), }] }, )
def should_serve(self, request): """ When requested, the endpoint should serve the packages """ ret = package_versions(self.package, request) self.assertEqual( ret, {'pkgs': { self.package.filename: self.package.get_url(request), }}) # Check the /json endpoint too ret = package_versions_json(self.package, request) self.assertEqual( ret['releases'], { '1.1': [ { 'filename': self.package.filename, 'url': self.package.get_url(request), }, ], })
def should_serve(self, request): """ When requested, the endpoint should serve the packages """ ret = package_versions(self.package, request) self.assertEqual( ret, {"pkgs": {self.package.filename: self.package.get_url(request)}} ) # Check the /json endpoint too ret = package_versions_json(self.package, request) self.assertEqual( ret["releases"], { "1.1": [ { "filename": self.package.filename, "url": self.package.get_url(request), } ] }, )