Mainflux.mainflux/readers/api
b1ackd0t 6bc931eb2a
NOISSUE - Fix Readers Tests (#1933)
* Add things auth and auth

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* feat(auth): add environment variable prefix for authorization gRPC client

This commit adds the environment variable prefix `MF_THINGS_AUTH_G` for the authorization gRPC client in the `internal/clients/grpc/auth/client.go` file. The prefix is used to configure the gRPC client for authorization.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* feat(auth): add mock implementation

This commit adds a new file `auth.go` to the `mocks` package. The file contains a mock implementation of the `mainflux.AuthzServiceClient` interface. This mock implementation is used for testing purposes and allows for easier unit testing of code that depends on the `AuthzServiceClient` interface.

The `auth.go` file includes the necessary imports and initializes a new struct that embeds the `mock.Mock` struct from the `github.com/stretchr/testify/mock` package. This struct provides methods for setting expectations and returning predefined responses during tests.

This addition will improve the testability of the codebase and facilitate the testing of components that rely on the `AuthzServiceClient` interface.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* feat(readers): add user authentication to listMessagesEndpoint

This commit adds user authentication to the listMessagesEndpoint function in the readers package. The function now takes an additional parameter, uauth, which is an instance of the mainflux.AuthServiceClient. This change allows the endpoint to verify the user's authentication before returning the list of messages.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

---------

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2023-10-23 15:36:42 +02:00
..
doc.go MF-1506 - Group-based Access Control (#1716) 2023-06-14 12:40:37 +02:00
endpoint.go NOISSUE - Fix Readers Tests (#1933) 2023-10-23 15:36:42 +02:00
endpoint_test.go NOISSUE - Fix Readers Tests (#1933) 2023-10-23 15:36:42 +02:00
logging.go MF-1308 - Use IETF Health Check standard (#1541) 2022-01-24 21:18:53 +01:00
metrics.go MF-1308 - Use IETF Health Check standard (#1541) 2022-01-24 21:18:53 +01:00
requests.go MF-1584 - Upgrade InfluxDB from 1.x to 2.x (#1709) 2023-03-16 02:36:14 +01:00
responses.go MF-1240 - Return to service transport layer only service errors (#1559) 2022-02-14 22:49:23 +01:00
transport.go NOISSUE - Fix Readers Tests (#1933) 2023-10-23 15:36:42 +02:00