The purpose of this project is to mock the response of chalmersit-account-rails for easier local development.
Make sure that the service being tested can reach this container on the same hostname and port as the browser. This means for rails projects that account_ip
should be set according to the following:
Set account_ip
to "docker.for.mac.localhost"
.
Also add the following line to /etc/hosts
:
127.0.0.1 docker.for.mac.localhost
Probably works out of the box - if this service is hosted on the same machine as the service being tested, localhost
should be sufficient.
...are you serious?
# build docker container
docker build -t cthit/account-mock .
# run with admin mock
docker run -it -e MOCK=admin -p 6789:3000 cthit/account-mock
# or fkit mock
docker run -it -e MOCK=fkit -p 6789:3000 cthit/account-mock
# Now accessible at http://localhost:6789
Returns the mock set by the MOCK
environment variable (look in the mocks/
folder for exact responses).
Reads redirect_uri
and state
from query params and redirects back to <redirect_uri>?state=<state>
.
Returns a hard coded dummy token. { "access_token": "i am access token" }
.
Reads return_to
from query params and redirects back to <return_to>
.
If no id is provided, it returns an array of all mocks.
If id is provided it will return the specified mock, with defaultmock
as fallback.
Returns the default mock (mocks/defaultmock.json
).
Run with yarn:
yarn start
Can specify PORT
environment variable.
PORT=5000 yarn start
Use MOCK
environment variable to select a mock:
The values admin
or fkit
will use the corresponding mocks, anything else will use the default mock.
MOCK=admin yarn start
# or
MOCK=fkit yarn start