The all letters library and web service can determine whether a given string contains all 26 English letters (a-z) regardless of case.
Install all dependencies by running pip install -r requirements.txt in the top-level project directory.
The validator service can be started by running gunicorn --access-logfile - stringer:app
A Docker container for this service can be generated by running docker build .. After an image is successfully built, the image can be started by running docker run -it -P <container-id>.
Here is an example request to the service:
$ curl -X POST -H 'Content-Type: application/json' --data '{"string": "abc"}' 'http://127.0.0.1:8000/all-letters-validator'
{"result": "fail"}
$ curl -X POST -H 'Content-Type: application/json' --data '{"string": "abcdefghijklmnopqrstuvwxyz"}' 'http://127.0.0.1:8000/all-letters-validator'
{"result": "pass"}
curl -X POST -H 'Content-Type: application/json' --data '{"string": "abcdefghijklmnopqrstuvwxyz @@ !! ?? .... +++ ----"}' 'http://127.0.0.1:8000/all-letters-validator'
{"result": "pass"}
Here's how to use the all letters validator directly:
>>> from app.validators.all_letters import AllLettersValidator
>>> v = AllLettersValidator()
>>> v.validate("abcdefghijklmnopqrstuvwxyz")
True
>>> v.validate("string")
False
You can execute unit tests by running pytest ./test/unit from the top-level project directory.
You can execute acceptance tests by running pytest ./test/acceptance from the top-level project directory.