This web server component provides a web interface to a connected smartcard.
The instructions below show how to run this web server either directly or via Docker. If you wish to use Docker, make sure both docker
and docker-compose
are installed. Otherwise the instructions assume you're running in Ubuntu, though other systems such as macOS work with appropriate changes.
Note: While using Docker is a great way to get this running with mock data for developing BMD, it's not straightforward to use Docker with real hardware. You can use both development approaches interchangeably, so pick the one that is most appropriate to the task at hand.
# without docker only -- docker handles this for you
sudo add-apt-repository ppa:deadsnakes/ppa
make install
make build
Install dependencies you need
# without docker only -- docker handles this for you
make build-dev
and then run the tests
# without docker
make test
# with docker
docker-compose run server-tests make test
With code coverage
# without docker
make coverage
# with docker
docker-compose run server-tests make coverage
The server will be available at http://localhost:3001/.
# without docker
make run
# with docker
docker-compose up
Once you're running the server, you can enable a mock card reader with fixture data as in the examples below. Check out the fixtures/
directory for what mock cards are available.
./mockCardReader.py enable --fixture fixtures/voter
./mockCardReader.py enable --fixture fixtures/pollworker
./mockCardReader.py enable --fixture fixtures/admin
./mockCardReader.py enable --fixture fixtures/blank
./mockCardReader.py enable --no-card