AtlatestRepositoryparlor
1
(import (sigil test)2
(sigil process)3
(parlor config))5
;; ============================================================6
;; parlor-base-url7
;; ============================================================9
(test-group "parlor-base-url"10
(test "reads DISCOURSE_URL from environment"11
(setenv! "DISCOURSE_URL" "https://test.forum.com")12
(assert-equal "https://test.forum.com" (parlor-base-url))13
(setenv! "DISCOURSE_URL" ""))15
(test "raises error when DISCOURSE_URL is not set"16
(setenv! "DISCOURSE_URL" "")17
(assert-error (parlor-base-url))))19
;; ============================================================20
;; parlor-api-key21
;; ============================================================23
(test-group "parlor-api-key"24
(test "reads DISCOURSE_API_KEY from environment"25
(setenv! "DISCOURSE_API_KEY" "test-key-123")26
(assert-equal "test-key-123" (parlor-api-key))27
(setenv! "DISCOURSE_API_KEY" ""))29
(test "raises error when DISCOURSE_API_KEY is not set"30
(setenv! "DISCOURSE_API_KEY" "")31
(assert-error (parlor-api-key))))33
;; ============================================================34
;; parlor-username35
;; ============================================================37
(test-group "parlor-username"38
(test "reads DISCOURSE_USERNAME from environment"39
(setenv! "DISCOURSE_USERNAME" "system")40
(assert-equal "system" (parlor-username))41
(setenv! "DISCOURSE_USERNAME" ""))43
(test "raises error when DISCOURSE_USERNAME is not set"44
(setenv! "DISCOURSE_USERNAME" "")45
(assert-error (parlor-username))))