1
0
mirror of https://github.com/mainflux/mainflux.git synced 2025-04-29 13:49:28 +08:00

22 lines
370 B
Go
Raw Normal View History

MF-1197 - Add MQTT adapter tests (#1622) * MF-1197 - add mqtt tests Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - add test cases Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - refactor tests Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix test names.Add const Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add mocks. Add publish test Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add buffer to logger Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add redis mock.Change logger error Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add new test cases Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix session fields Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix bad logs. Fix tests Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add new test case.Fix names. Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix test name Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Refactoring tests Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Wrap errors Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Wrap errors. Fix logs level Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Wrap errors. Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix var names Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-888 - Add clientID err check.Refactor tests Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix info and err names Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Remove redundant log and channel parts check Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Revert channel parts check Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add authorize test case Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Remove unused var Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Change var name Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 -Add missing test case.Change var name Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 -Add err case. Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 -Change var name Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Use logMsg for all logs Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Use logs instead of errors Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Use redis mock Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Return interface in constructor Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add missing test cases. Create consts Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add global vars Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Refactor code Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Remove unused var Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Remove unnecessary var Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Use created session client Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Refactor vars Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Separate constant Signed-off-by: zzokki81 <zoran.rebic@outlook.com> Signed-off-by: zzokki81 <zoran.rebic@outlook.com>
2022-11-21 14:40:19 +01:00
package mocks
import (
"context"
MF-1197 - Add MQTT adapter tests (#1622) * MF-1197 - add mqtt tests Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - add test cases Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - refactor tests Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix test names.Add const Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add mocks. Add publish test Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add buffer to logger Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add redis mock.Change logger error Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add new test cases Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix session fields Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix bad logs. Fix tests Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add new test case.Fix names. Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix test name Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Refactoring tests Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Wrap errors Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Wrap errors. Fix logs level Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Wrap errors. Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix var names Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-888 - Add clientID err check.Refactor tests Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix info and err names Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Remove redundant log and channel parts check Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Revert channel parts check Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add authorize test case Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Remove unused var Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Change var name Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 -Add missing test case.Change var name Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 -Add err case. Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 -Change var name Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Use logMsg for all logs Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Use logs instead of errors Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Use redis mock Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Return interface in constructor Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add missing test cases. Create consts Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add global vars Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Refactor code Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Remove unused var Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Remove unnecessary var Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Use created session client Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Refactor vars Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Separate constant Signed-off-by: zzokki81 <zoran.rebic@outlook.com> Signed-off-by: zzokki81 <zoran.rebic@outlook.com>
2022-11-21 14:40:19 +01:00
"github.com/mainflux/mainflux/mqtt/redis"
)
type MockEventStore struct{}
func NewEventStore() redis.EventStore {
return MockEventStore{}
}
func (es MockEventStore) Connect(ctx context.Context, clientID string) error {
MF-1197 - Add MQTT adapter tests (#1622) * MF-1197 - add mqtt tests Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - add test cases Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - refactor tests Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix test names.Add const Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add mocks. Add publish test Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add buffer to logger Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add redis mock.Change logger error Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add new test cases Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix session fields Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix bad logs. Fix tests Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add new test case.Fix names. Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix test name Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Refactoring tests Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Wrap errors Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Wrap errors. Fix logs level Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Wrap errors. Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix var names Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-888 - Add clientID err check.Refactor tests Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix info and err names Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Remove redundant log and channel parts check Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Revert channel parts check Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add authorize test case Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Remove unused var Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Change var name Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 -Add missing test case.Change var name Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 -Add err case. Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 -Change var name Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Use logMsg for all logs Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Use logs instead of errors Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Use redis mock Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Return interface in constructor Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add missing test cases. Create consts Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add global vars Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Refactor code Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Remove unused var Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Remove unnecessary var Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Use created session client Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Refactor vars Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Separate constant Signed-off-by: zzokki81 <zoran.rebic@outlook.com> Signed-off-by: zzokki81 <zoran.rebic@outlook.com>
2022-11-21 14:40:19 +01:00
return nil
}
func (es MockEventStore) Disconnect(ctx context.Context, clientID string) error {
MF-1197 - Add MQTT adapter tests (#1622) * MF-1197 - add mqtt tests Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - add test cases Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - refactor tests Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix test names.Add const Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add mocks. Add publish test Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add buffer to logger Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add redis mock.Change logger error Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add new test cases Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix session fields Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix bad logs. Fix tests Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add new test case.Fix names. Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix test name Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Refactoring tests Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Wrap errors Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Wrap errors. Fix logs level Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Wrap errors. Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix var names Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-888 - Add clientID err check.Refactor tests Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Fix info and err names Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Remove redundant log and channel parts check Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Revert channel parts check Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add authorize test case Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Remove unused var Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Change var name Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 -Add missing test case.Change var name Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 -Add err case. Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 -Change var name Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Use logMsg for all logs Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Use logs instead of errors Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Use redis mock Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Return interface in constructor Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add missing test cases. Create consts Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Add global vars Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Refactor code Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Remove unused var Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Remove unnecessary var Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Use created session client Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Refactor vars Signed-off-by: zzokki81 <zoran.rebic@outlook.com> * MF-1197 - Separate constant Signed-off-by: zzokki81 <zoran.rebic@outlook.com> Signed-off-by: zzokki81 <zoran.rebic@outlook.com>
2022-11-21 14:40:19 +01:00
return nil
}