-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchristopher_suite_test.go
114 lines (88 loc) · 2.77 KB
/
christopher_suite_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package main
import (
"bytes"
"fmt"
"github.com/davidderus/christopher/config"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/urfave/cli"
"testing"
)
func TestChristopher(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Christopher Suite")
}
var _ = Describe("Christopher", func() {
var cliApp *cli.App
BeforeEach(func() {
cliApp = christopherApp()
})
Context("version", func() {
It("should return the correct version number", func() {
Expect(cliApp.Version).To(Equal(christopherVersion))
})
})
Context("feed-watcher --help", func() {
It("should show the feed watcher help", func() {
cliBuffer := new(bytes.Buffer)
cliApp.Writer = cliBuffer
fwErr := cliApp.Run([]string{"feed-watcher", "--help"})
fwOutput := cliBuffer.String()
Expect(fwErr).To(BeNil())
Expect(fwOutput).To(ContainSubstring("Starts the feed watcher"))
})
})
Context("download --help", func() {
It("should show the downloader help", func() {
cliBuffer := new(bytes.Buffer)
cliApp.Writer = cliBuffer
fwErr := cliApp.Run([]string{"download", "--help"})
fwOutput := cliBuffer.String()
Expect(fwErr).To(BeNil())
Expect(fwOutput).To(ContainSubstring("Sends an URI to the downloader"))
})
})
Context("debrid --help", func() {
It("should show the debrider help", func() {
cliBuffer := new(bytes.Buffer)
cliApp.Writer = cliBuffer
fwErr := cliApp.Run([]string{"debrid", "--help"})
fwOutput := cliBuffer.String()
Expect(fwErr).To(BeNil())
Expect(fwOutput).To(ContainSubstring("Debrids an URI"))
})
})
Context("debrid-download --help", func() {
It("should show the debrid-downloader help", func() {
cliBuffer := new(bytes.Buffer)
cliApp.Writer = cliBuffer
fwErr := cliApp.Run([]string{"debrid-download", "--help"})
fwOutput := cliBuffer.String()
Expect(fwErr).To(BeNil())
Expect(fwOutput).To(ContainSubstring("Debrids and downloads an URI"))
})
})
Context("--config", func() {
It("should show the config flag", func() {
cliBuffer := new(bytes.Buffer)
cliApp.Writer = cliBuffer
fwErr := cliApp.Run([]string{"--help"})
fwOutput := cliBuffer.String()
Expect(fwErr).To(BeNil())
Expect(fwOutput).To(ContainSubstring("--config"))
// Also contains a default value for config
defaultConfigString := fmt.Sprintf("Load configuration from FILE (default: \"%s\")", config.DefaultConfigPath())
Expect(fwOutput).To(ContainSubstring(defaultConfigString))
})
})
Context("webserver", func() {
It("should show the webserver help", func() {
cliBuffer := new(bytes.Buffer)
cliApp.Writer = cliBuffer
fwErr := cliApp.Run([]string{"webserver"})
fwOutput := cliBuffer.String()
Expect(fwErr).To(BeNil())
Expect(fwOutput).To(ContainSubstring("Starts the webserver"))
})
})
})