;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2019-2021, 2024 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (test-swh) #:use-module (guix swh) #:use-module (guix base32) #:use-module (guix tests http) #:use-module (web response) #:use-module (srfi srfi-19) #:use-module (srfi srfi-64) #:use-module (ice-9 match)) ;; Test the JSON mapping machinery
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntero Mejr <antero@mailbox.org>2023-06-04 17:42:49 +0000
committerDanny Milosavljevic <dannym@friendly-machines.com>2024-12-22 13:19:19 +0100
commit87c928e1620e7326aa46d86f24905f56fd96d627 (patch)
tree4437100b2fe960f18e82e91ec22312920fdfb0fd /gnu/packages/usb-modeswitch.scm
parentcca94f021fed9ff60c97537357a0ce6b9dcd2ecb (diff)
downloadguix-87c928e1620e7326aa46d86f24905f56fd96d627.tar.gz
guix-87c928e1620e7326aa46d86f24905f56fd96d627.zip
gnu: Add spamassassin.
* gnu/packages/perl-web.scm (spamassassin): New variable. Signed-off-by: Danny Milosavljevic <dannym@friendly-machines.com>
Diffstat (limited to 'gnu/packages/usb-modeswitch.scm')
0 files changed, 0 insertions, 0 deletions
vision (lookup-origin-revision "https://example.org/repo.git" "1.3.2"))) (list (revision-id revision) (revision-directory revision))))))) (test-equal "lookup-directory-by-nar-hash" "swh:1:dir:84a8b34591712c0a90bab0af604188bcd1fe3153" (with-json-result %external-id (lookup-directory-by-nar-hash (nix-base32-string->bytevector "0qqygvlpz63phdi2p5p8ncp80dci230qfa3pwds8yfxqqaablmhb") 'sha256))) (test-equal "rate limit reached" 3000000000 (let ((too-many (build-response #:code 429 #:reason-phrase "Too many requests" ;; Pretend we've reached the limit and it'll be reset in ;; June 2065. #:headers '((x-ratelimit-remaining . "0") (x-ratelimit-reset . "3000000000"))))) (with-http-server `((,too-many "Too bad.")) (parameterize ((%swh-base-url (%local-url))) (catch 'swh-error (lambda () (lookup-origin "http://example.org/guix.git")) (lambda (key url method response) ;; Ensure the reset time was recorded. (@@ (guix swh) %general-rate-limit-reset-time))))))) (test-assert "%allow-request? and request-rate-limit-reached?" ;; Here we test two things: that the rate limit set above is in effect and ;; that %ALLOW-REQUEST? is called, and that 'request-rate-limit-reached?' ;; returns true. (let* ((key (gensym "skip-request")) (skip-if-limit-reached (lambda (url method) (or (not (request-rate-limit-reached? url method)) (throw key #t))))) (parameterize ((%allow-request? skip-if-limit-reached)) (catch key (lambda () (lookup-origin "http://example.org/guix.git") #f) (const #t))))) (test-end "swh") ;; Local Variables: ;; eval: (put 'with-json-result 'scheme-indent-function 1) ;; eval: (put 'with-http-server 'scheme-indent-function 1) ;; End: