Documentation ¶
Index ¶
- Constants
- func AddOrgThing(t *testing.T, db *mongo.Database, orgId primitive.ObjectID, thingName string)
- func AddOrgUser(t *testing.T, db *mongo.Database, orgId, userId primitive.ObjectID)
- func Assert(tb testing.TB, condition bool, msg string, v ...interface{})
- func CleanDb(t *testing.T, db *mongo.Database)
- func Contains(t *testing.T, str, pattern string)
- func CreateDevice(t *testing.T, db *mongo.Database, name string) primitive.ObjectID
- func CreateOrg(t *testing.T, db *mongo.Database, name string) primitive.ObjectID
- func CreateSwitch(t *testing.T, db *mongo.Database, name string) primitive.ObjectID
- func CreateThing(t *testing.T, db *mongo.Database, name string) primitive.ObjectID
- func CreateUser(t *testing.T, db *mongo.Database, email, password string) primitive.ObjectID
- func Equals(tb testing.TB, exp, act interface{})
- func GetConfig() *config.Parameters
- func GetDb(t *testing.T) *mongo.Database
- func GetLogger(t *testing.T) *logging.Logger
- func GetOrgs(t *testing.T, logger *logging.Logger, db *mongo.Database) *piot.Orgs
- func GetPiotDevices(t *testing.T, logger *logging.Logger, things *piot.Things, mqtt piot.IMqtt) *piot.PiotDevices
- func GetThings(t *testing.T, logger *logging.Logger, db *mongo.Database) *piot.Things
- func GetUsers(t *testing.T, logger *logging.Logger, db *mongo.Database) *piot.Users
- func Ok(tb testing.TB, err error)
- func SetSensorMeasurementTopic(t *testing.T, db *mongo.Database, thingId primitive.ObjectID, topic string)
- func SetSwitchStateTopic(t *testing.T, db *mongo.Database, thingId primitive.ObjectID, ...)
- func SetThingLocationParams(t *testing.T, db *mongo.Database, thingId primitive.ObjectID, topic string, ...)
- func SetThingTelemetryTopic(t *testing.T, db *mongo.Database, thingId primitive.ObjectID, topic string)
- type HttpClientMock
- type InfluxDbMock
- type MqttMock
- func (t *MqttMock) Connect(subscribe bool) error
- func (t *MqttMock) Disconnect() error
- func (t *MqttMock) ProcessMessage(topic, payload string)
- func (t *MqttMock) PushThingData(thing *model.Thing, topic, value string) error
- func (t *MqttMock) SetClient(id string)
- func (t *MqttMock) SetPassword(password string)
- func (t *MqttMock) SetUsername(username string)
- type MysqlDbMock
Constants ¶
View Source
const LOG_FORMAT = "%{color}%{time:2006/01/02 15:04:05 -07:00 MST} [%{level:.6s}] %{shortfile} : %{color:reset}%{message}"
Variables ¶
This section is empty.
Functions ¶
func AddOrgThing ¶
func AddOrgUser ¶
func CreateDevice ¶
func CreateSwitch ¶
func CreateThing ¶
func CreateUser ¶
func GetConfig ¶
func GetConfig() *config.Parameters
func GetPiotDevices ¶
func SetSwitchStateTopic ¶
func SetThingLocationParams ¶
Types ¶
type HttpClientMock ¶
type HttpClientMock struct { Log *logging.Logger Calls []httpClientMockCall }
implements IMqtt interface
func GetHttpClient ¶
func GetHttpClient(t *testing.T, logger *logging.Logger) *HttpClientMock
func (*HttpClientMock) PostString ¶
func (c *HttpClientMock) PostString(url, body string, username *string, password *string)
type InfluxDbMock ¶
type InfluxDbMock struct { Log *logging.Logger Calls []influxDbMockCall }
implements IMqtt interface
func GetInfluxDb ¶
func GetInfluxDb(t *testing.T, logger *logging.Logger) *InfluxDbMock
func (*InfluxDbMock) PostLocation ¶ added in v1.0.2
func (db *InfluxDbMock) PostLocation(thing *model.Thing, lat, lng float64, sat, ts int32)
func (*InfluxDbMock) PostMeasurement ¶
func (db *InfluxDbMock) PostMeasurement(thing *model.Thing, value string)
func (*InfluxDbMock) PostSwitchState ¶
func (db *InfluxDbMock) PostSwitchState(thing *model.Thing, value string)
type MqttMock ¶
type MqttMock struct { Log *logging.Logger Calls []call }
implements IMqtt interface
func (*MqttMock) Disconnect ¶
func (*MqttMock) ProcessMessage ¶
func (*MqttMock) PushThingData ¶
func (*MqttMock) SetPassword ¶
func (*MqttMock) SetUsername ¶
type MysqlDbMock ¶
type MysqlDbMock struct { Log *logging.Logger Calls []mysqlDbMockCall }
implements IMysqlDb interface
func GetMysqlDb ¶
func GetMysqlDb(t *testing.T, logger *logging.Logger) *MysqlDbMock
func (*MysqlDbMock) Close ¶
func (db *MysqlDbMock) Close()
func (*MysqlDbMock) Open ¶
func (db *MysqlDbMock) Open() error
func (*MysqlDbMock) StoreMeasurement ¶
func (db *MysqlDbMock) StoreMeasurement(thing *model.Thing, value string)
func (*MysqlDbMock) StoreSwitchState ¶
func (db *MysqlDbMock) StoreSwitchState(thing *model.Thing, value string)
Click to show internal directories.
Click to hide internal directories.