mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
import: cpan: Rewrite tests to use an HTTP server instead of mocking.
* guix/import/cpan.scm (%metacpan-base-url): New variable. (module->dist-name, cpan-fetch): Refer to it instead of the hard-coded URL. * tests/cpan.scm ("cpan->guix-package"): Use 'with-http-server' instead of 'mock'.
This commit is contained in:
parent
69f132554c
commit
4aea90b187
2 changed files with 43 additions and 50 deletions
|
@ -61,7 +61,9 @@
|
|||
cpan-fetch
|
||||
cpan->guix-package
|
||||
metacpan-url->mirror-url
|
||||
%cpan-updater))
|
||||
%cpan-updater
|
||||
|
||||
%metacpan-base-url))
|
||||
|
||||
;;; Commentary:
|
||||
;;;
|
||||
|
@ -70,6 +72,10 @@
|
|||
;;;
|
||||
;;; Code:
|
||||
|
||||
(define %metacpan-base-url
|
||||
;; Base URL of the MetaCPAN API.
|
||||
(make-parameter "https://fastapi.metacpan.org/v1/"))
|
||||
|
||||
;; Dependency of a "release".
|
||||
(define-json-mapping <cpan-dependency> make-cpan-dependency cpan-dependency?
|
||||
json->cpan-dependency
|
||||
|
@ -149,7 +155,7 @@
|
|||
module is distributed with 'Test::Simple', so (module->dist-name \"ok\") would
|
||||
return \"Test-Simple\""
|
||||
(assoc-ref (json-fetch (string-append
|
||||
"https://fastapi.metacpan.org/v1/module/"
|
||||
(%metacpan-base-url) "/module/"
|
||||
module
|
||||
"?fields=distribution"))
|
||||
"distribution"))
|
||||
|
@ -176,7 +182,7 @@ or #f on failure. MODULE should be the distribution name, such as
|
|||
\"Test-Script\" for the \"Test::Script\" module."
|
||||
;; This API always returns the latest release of the module.
|
||||
(json->cpan-release
|
||||
(json-fetch (string-append "https://fastapi.metacpan.org/v1/release/"
|
||||
(json-fetch (string-append (%metacpan-base-url) "/release/"
|
||||
name))))
|
||||
|
||||
(define (cpan-home name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue