Giter Club home page Giter Club logo

landregistry.digital-street-lender-management-api's Introduction

HM Land Registry Digital Street Proof of Concept - Lender Management API

Available routes

Route What it does
GET /health Returns some basic information about the app (JSON)
GET /health/cascade/<depth> Returns the app's health information as above but also the health information of any database and HTTP dependencies, down to the specified depth (JSON)
GET /users Returns a list of users in the conveyancer's management system (JSON)
POST /users Creates a new user in the conveyancer's management system (JSON)
GET /users/<identity> Returns a user with the specified id. (JSON)
PUT /users/<identity> Modifies a user with the specified id. (JSON)

Quick start

Docker

This app supports the Land Registry common development environment so adding the following to your dev-env config file is enough:

  lender-management-api:
    repo: https://github.com/LandRegistry/digital-street-lender-management-api.git
    branch: master

The Docker image it creates (and runs) will install all necessary requirements and set all environment variables for you.

Standalone

Environment variables to set

  • PYTHONUNBUFFERED (suggested value: yes)

  • PORT

  • LOG_LEVEL

  • COMMIT

  • APP_NAME

  • MAX_HEALTH_CASCADE

  • DEFAULT_TIMEOUT (suggested value: 30)

    (The default timeout is applied to all calls which go via g.requests but can be overriden on a case by case basis with the standard timeout argument)

When not using gunicorn
  • FLASK_APP (suggested value: user_api/main.py)
  • FLASK_DEBUG (suggested value: 1)

Running (when not using gunicorn)

(The third party libraries are defined in requirements.txt and can be installed using pip)

python3 -m flask run
or
flask run
or
make run

Testing

Unit tests

The unit tests are contained in the unit_tests folder. Pytest is used for unit testing. To run the tests use the following command:

make unittest
(or just py.test)

To run them and output a coverage report and a junit xml file run:

make report="true" unittest

These files get added to a test-output folder. The test-output folder is created if doesn't exist.

You can run these commands in the app's running container via docker-compose exec lender-management-api <command> or exec lender-management-api <command>. There is also an alias: unit-test lender-management-api and unit-test lender-management-api -r will run tests and generate reports respectively.

Integration tests

The integration tests are contained in the integration_tests folder. Pytest is used for integration testing. To run the tests and output a junit xml use the following command:

make integrationtest
(or py.test integration_tests)

This file gets added to the test-output folder. The test-output folder is created if doesn't exist.

To run the integration tests if you are using the common dev-env you can run docker-compose exec lender-management-api make integrationtest or, using the alias, integration-test lender-management-api.

landregistry.digital-street-lender-management-api's People

Contributors

matthew-shaw avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.