aboutsummaryrefslogtreecommitdiff
path: root/hotline/transaction_handlers_test.go
diff options
context:
space:
mode:
authorJeff Halter <868228+jhalter@users.noreply.github.com>2024-06-10 09:00:13 -0700
committerJeff Halter <868228+jhalter@users.noreply.github.com>2024-06-10 09:01:14 -0700
commit5cc444c89968dda9060d4e2f458b1babb9b603cd (patch)
tree3ee4a40710a18996d3673ac5f260df7c5ccd1a12 /hotline/transaction_handlers_test.go
parentc29db3dbd0491119755db5d99443dac423b2681b (diff)
Read banner once at startup
Diffstat (limited to 'hotline/transaction_handlers_test.go')
-rw-r--r--hotline/transaction_handlers_test.go66
1 files changed, 0 insertions, 66 deletions
diff --git a/hotline/transaction_handlers_test.go b/hotline/transaction_handlers_test.go
index ca1722f..81ba6e0 100644
--- a/hotline/transaction_handlers_test.go
+++ b/hotline/transaction_handlers_test.go
@@ -3338,72 +3338,6 @@ func TestHandleDelNewsItem(t *testing.T) {
}
}
-func TestHandleDownloadBanner(t *testing.T) {
- type args struct {
- cc *ClientConn
- t *Transaction
- }
- tests := []struct {
- name string
- args args
- wantRes []Transaction
- wantErr assert.ErrorAssertionFunc
- }{
- {
- name: "returns expected response",
- args: args{
- cc: &ClientConn{
- ID: &[]byte{0, 1},
- transfers: map[int]map[[4]byte]*FileTransfer{
- bannerDownload: {},
- },
- Server: &Server{
- ConfigDir: "/config",
- Config: &Config{
- BannerFile: "banner.jpg",
- },
- fileTransfers: map[[4]byte]*FileTransfer{},
- FS: func() *MockFileStore {
- mfi := &MockFileInfo{}
- mfi.On("Size").Return(int64(100))
-
- mfs := &MockFileStore{}
- mfs.On("Stat", "/config/banner.jpg").Return(mfi, nil)
- return mfs
- }(),
- },
- },
- t: NewTransaction(TranDownloadBanner, nil),
- },
- wantRes: []Transaction{
- {
- clientID: &[]byte{0, 1},
- Flags: 0x00,
- IsReply: 0x01,
- Type: []byte{0, 0},
- ID: []byte{0, 0, 0, 0},
- ErrorCode: []byte{0, 0, 0, 0},
- Fields: []Field{
- NewField(FieldRefNum, []byte{1, 2, 3, 4}),
- NewField(FieldTransferSize, []byte{0, 0, 0, 0x64}),
- },
- },
- },
- wantErr: assert.NoError,
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- gotRes, err := HandleDownloadBanner(tt.args.cc, tt.args.t)
- if !tt.wantErr(t, err, fmt.Sprintf("HandleDownloadBanner(%v, %v)", tt.args.cc, tt.args.t)) {
- return
- }
-
- tranAssertEqual(t, tt.wantRes, gotRes)
- })
- }
-}
-
func TestHandleTranOldPostNews(t *testing.T) {
type args struct {
cc *ClientConn