mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-24 06:25:47 +00:00
* used this to pass tests * made the MockMqttMonitor a global object so that it can be easily mocked * removed MockMqttMonitor from the app/keeper initialization * adjusted test cases to register "active machines" to the mqttmonitor Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
39 lines
963 B
Go
39 lines
963 B
Go
package mocks
|
|
|
|
import (
|
|
types "github.com/cosmos/cosmos-sdk/types"
|
|
)
|
|
|
|
// MockMQTTMonitorClientI is a mock of MQTTMonitorClientI interface.
|
|
type MockMQTTMonitorClientI struct {
|
|
myStringList []string
|
|
}
|
|
|
|
// AddParticipant mocks base method.
|
|
func (m *MockMQTTMonitorClientI) AddParticipant(address string, lastSeenTS int64) error {
|
|
m.myStringList = append(m.myStringList, address)
|
|
|
|
return nil
|
|
}
|
|
|
|
// SelectPoPParticipantsOutOfActiveActors mocks base method.
|
|
func (m *MockMQTTMonitorClientI) SelectPoPParticipantsOutOfActiveActors() (string, string, error) {
|
|
var challenger, challengee string
|
|
amount := len(m.myStringList)
|
|
if amount >= 2 {
|
|
challenger = m.myStringList[amount-2]
|
|
challengee = m.myStringList[amount-1]
|
|
}
|
|
return challenger, challengee, nil
|
|
}
|
|
|
|
// SetContext mocks base method.
|
|
func (m *MockMQTTMonitorClientI) SetContext(ctx types.Context) {
|
|
return
|
|
}
|
|
|
|
// Start mocks base method.
|
|
func (m *MockMQTTMonitorClientI) Start() error {
|
|
return nil
|
|
}
|