Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/google/uuid v1.6.0
github.com/jarcoal/httpmock v1.4.1
github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056
github.com/spf13/cobra v1.10.1
github.com/spf13/cobra v1.10.2
github.com/stretchr/testify v1.11.1
golang.org/x/net v0.47.0
golang.org/x/term v0.37.0
Expand Down
5 changes: 3 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,16 @@ github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0=
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY=
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf h1:pvbZ0lM0XWPBqUKqFU8cmavspvIl9nulOYwdy6IFRRo=
github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf/go.mod h1:RJID2RhlZKId02nZ62WenDCkgHFerpIOmW0iT7GKmXM=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
Expand Down
14 changes: 7 additions & 7 deletions internal/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ func TestHTTPClientFactoryCreate(t *testing.T) {
}, {
"Define a timeout alone",
func() {
os.Setenv("YOGO_REQUEST_TIMEOUT", "10")
assert.NoError(t, os.Setenv("YOGO_REQUEST_TIMEOUT", "10"))
},
func(c *http.Client, err error) {
assert.NoError(t, err)
Expand All @@ -540,33 +540,33 @@ func TestHTTPClientFactoryCreate(t *testing.T) {
}, {
"Define an HTTP proxy URL",
func() {
os.Setenv("HTTP_PROXY", "http://localhost:8000")
assert.NoError(t, os.Setenv("HTTP_PROXY", "http://localhost:8000"))
},
func(c *http.Client, err error) {
assert.NoError(t, err)
},
}, {
"Define an HTTPs proxy URL",
func() {
os.Setenv("HTTPS_PROXY", "http://localhost:8000")
assert.NoError(t, os.Setenv("HTTPS_PROXY", "http://localhost:8000"))
},
func(c *http.Client, err error) {
assert.NoError(t, err)
},
}, {
"Define a wrong proxy URL",
func() {
os.Setenv("HTTP_PROXY", "l\n")
assert.NoError(t, os.Setenv("HTTP_PROXY", "l\n"))
},
func(c *http.Client, err error) {
assert.Error(t, err)
assert.EqualError(t, err, `parse "l\n": net/url: invalid control character in URL`)
},
}} {
t.Run(s.name, func(t *testing.T) {
os.Setenv("HTTP_PROXY", "")
os.Setenv("HTTPS_PROXY", "")
os.Setenv("YOGO_REQUEST_TIMEOUT", "")
assert.NoError(t, os.Setenv("HTTP_PROXY", ""))
assert.NoError(t, os.Setenv("HTTPS_PROXY", ""))
assert.NoError(t, os.Setenv("YOGO_REQUEST_TIMEOUT", ""))
s.setup()
h := httpClientFactory{}
c, err := h.create()
Expand Down
11 changes: 4 additions & 7 deletions internal/inbox/inbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,8 @@ func TestFlush(t *testing.T) {
inbox, err := NewInbox[client.MailHTMLDoc]("test", false)
assert.NoError(t, err)

err = inbox.ParseInboxPages(15)
inbox.Flush()

assert.NoError(t, err)
assert.NoError(t, inbox.ParseInboxPages(15))
assert.NoError(t, inbox.Flush())
}

func TestFlushEmptyInbox(t *testing.T) {
Expand Down Expand Up @@ -458,10 +456,9 @@ func TestFlushEmptyInbox(t *testing.T) {
inbox, err := NewInbox[client.MailHTMLDoc]("test", false)
assert.NoError(t, err)

err = inbox.ParseInboxPages(1)
inbox.Flush()
assert.NoError(t, inbox.ParseInboxPages(1))
assert.NoError(t, inbox.Flush())

assert.NoError(t, err)
assert.Equal(t, 0, inbox.Count())
}

Expand Down
Loading