-
Install bats-core test runner, this provides the
bats
executable. -
Install Mainflux via Docker or use
BASE_URL
to point to an existing installation. -
Clone this repository and
cd
into it.
Create random user profile and export TOKEN
env variable:
export TOKEN="$(./register)"
Then run all tests in the current directory:
bats .
Variable | Description | Default |
---|---|---|
BASE_URL | Base URL of the HTTP API | https://localhost |
TOKEN | Authorization token for HTTP API | empty string |
Example specifying base URL on command line:
BASE_URL=https://localhost:8000 bats .
The register script can be used to create specific account and get an authorization token. By default the email and password will be randomly generated.
$ ./register
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NTc5MDMwMjksImlhdCI6MTU1Nzg2NzAyOSwiaXNzIjoibWFpbmZsdXgiLCJzdWIiOiJtZUBleGFtcGxlLmNvbSJ9.McLnP2hf676POaLvu5UI1O6b_ZFOiGxDIgJaMwIXmm8
Then export token to use in tests:
export TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NTc5MDMwMjksImlhdCI6MTU1Nzg2NzAyOSwiaXNzIjoibWFpbmZsdXgiLCJzdWIiOiJtZUBleGFtcGxlLmNvbSJ9.McLnP2hf676POaLvu5UI1O6b_ZFOiGxDIgJaMwIXmm8
Variable | Description | Default |
---|---|---|
Email address | [10 random characters]@example.com | |
PASS | Password | 10 random characters |
Example specifying email and password on command line:
[email protected] PASS=secret ./register