mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
tests: Mock up http-fetch in import tests.
This is a follow-up to commit 63773200d7
.
* tests/gem.scm ("gem->guix-package"): Replace mock definition of
"url-fetch" with "http-fetch".
* tests/pypi.scm ("pypi->guix-package"): Add mock definition of
"http-fetch".
This commit is contained in:
parent
51d8395ac6
commit
506abddb99
2 changed files with 55 additions and 50 deletions
|
@ -1,5 +1,6 @@
|
|||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2015 David Thompson <davet@gnu.org>
|
||||
;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
|
@ -45,13 +46,12 @@
|
|||
|
||||
(test-assert "gem->guix-package"
|
||||
;; Replace network resources with sample data.
|
||||
(mock ((guix import utils) url-fetch
|
||||
(lambda (url file-name)
|
||||
(mock ((guix http-client) http-fetch
|
||||
(lambda (url)
|
||||
(match url
|
||||
("https://rubygems.org/api/v1/gems/foo.json"
|
||||
(with-output-to-file file-name
|
||||
(lambda ()
|
||||
(display test-json))))
|
||||
(values (open-input-string test-json)
|
||||
(string-length test-json)))
|
||||
(_ (error "Unexpected URL: " url)))))
|
||||
(match (gem->guix-package "foo")
|
||||
(('package
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue