test-name: lookup-origin location: /home/sylviidae/guix/git/guix/tada/tests/swh.scm:49 source: + (test-equal + "lookup-origin" + (list "git" "http://example.org/guix.git") + (with-json-result + %origin + (let ((origin + (lookup-origin "http://example.org/guix.git"))) + (list (origin-type origin) (origin-url origin))))) expected-value: ("git" "http://example.org/guix.git") actual-value: ("git" "http://example.org/guix.git") result: PASS test-name: lookup-origin, not found location: /home/sylviidae/guix/git/guix/tada/tests/swh.scm:56 source: + (test-equal + "lookup-origin, not found" + #f + (with-http-server + `((404 "Nope.")) + (parameterize + ((%swh-base-url (%local-url))) + (lookup-origin "http://example.org/whatever")))) expected-value: #f actual-value: #f result: PASS test-name: lookup-directory location: /home/sylviidae/guix/git/guix/tada/tests/swh.scm:62 source: + (test-equal + "lookup-directory" + '(("one" 123) ("two" 456)) + (with-json-result + %directory-entries + (map (lambda (entry) + (list (directory-entry-name entry) + (directory-entry-length entry))) + (lookup-directory "123")))) expected-value: (("one" 123) ("two" 456)) actual-value: #f actual-error: + (json-invalid #) result: FAIL test-name: rate limit reached location: /home/sylviidae/guix/git/guix/tada/tests/swh.scm:70 source: + (test-equal + "rate limit reached" + 3000000000 + (let ((too-many + (build-response + #:code + 429 + #:reason-phrase + "Too many requests" + #: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) + (@@ (guix swh) %general-rate-limit-reset-time))))))) expected-value: 3000000000 actual-value: 3000000000 result: PASS test-name: %allow-request? and request-rate-limit-reached? location: /home/sylviidae/guix/git/guix/tada/tests/swh.scm:89 source: + (test-assert + "%allow-request? and request-rate-limit-reached?" + (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))))) actual-value: #t result: PASS