mirror of
https://github.com/elyby/chrly.git
synced 2024-12-02 11:40:56 +05:30
34 lines
704 B
Go
34 lines
704 B
Go
|
package tests
|
||
|
|
||
|
import (
|
||
|
"github.com/elyby/chrly/api/mojang"
|
||
|
|
||
|
"github.com/stretchr/testify/mock"
|
||
|
)
|
||
|
|
||
|
type MojangTexturesQueueMock struct {
|
||
|
mock.Mock
|
||
|
}
|
||
|
|
||
|
func (m *MojangTexturesQueueMock) GetTexturesForUsername(username string) chan *mojang.SignedTexturesResponse {
|
||
|
args := m.Called(username)
|
||
|
result := make(chan *mojang.SignedTexturesResponse)
|
||
|
arg := args.Get(0)
|
||
|
switch arg.(type) {
|
||
|
case *mojang.SignedTexturesResponse:
|
||
|
go func() {
|
||
|
result <- arg.(*mojang.SignedTexturesResponse)
|
||
|
}()
|
||
|
case chan *mojang.SignedTexturesResponse:
|
||
|
return arg.(chan *mojang.SignedTexturesResponse)
|
||
|
case nil:
|
||
|
go func() {
|
||
|
result <- nil
|
||
|
}()
|
||
|
default:
|
||
|
panic("unsupported return value")
|
||
|
}
|
||
|
|
||
|
return result
|
||
|
}
|