11# time-tracker-api
22
3+ The API of the TSheets killer app.
4+
35## Getting started
4- Follow the following instructions to get the project ready to use ASAP:
6+ Follow the following instructions to get the project ready to use ASAP.
57
68### Requirements
79Be sure you have installed in your system
@@ -10,7 +12,7 @@ Be sure you have installed in your system
1012automatically [ pip] ( https://pip.pypa.io/en/stable/ ) as well.
1113- A virtual environment, namely [ venv] ( https://docs.python.org/3/library/venv.html ) .
1214
13- ## Setup
15+ ### Setup
1416
1517- Create and activate the environment,
1618
@@ -26,13 +28,16 @@ automatically [pip](https://pip.pypa.io/en/stable/) as well.
2628 virtualenv .venv
2729 source .venv/bin/activate
2830 ```
31+
2932- Install the requirements:
3033 ```
31- python3 -m pip install -r requirements/prod .txt
34+ python3 -m pip install -r requirements/<stage> .txt
3235 ```
36+
37+ The `stage` can be `dev` or `prod`.
3338 Remember to do it with Python 3.
3439
35- ## How to use it
40+ ### How to use it
3641- Set the env var `FLASK_APP` to `time_tracker_api` and start the app:
3742
3843 In Windows
@@ -50,7 +55,47 @@ automatically [pip](https://pip.pypa.io/en/stable/) as well.
5055a link to the swagger.json with the definition of the api.
5156
5257
53- ## CLI
58+ ## Development
59+
60+ ### Test
61+ We are using Pytest](https://docs.pytest.org/en/latest/index.html) for tests. The tests are located in the package
62+ `tests` and use the [conventions for python test discovery](https://docs.pytest.org/en/latest/goodpractices.html#test-discovery).
63+
64+ To run the tests just execute:
65+
66+ ```
67+ python3 -m pytest -v
68+ ```
69+
70+ The option `-v` shows which tests failed or succeeded. Have into account that you can also debug each test
71+ (test_* files) with the help of an IDE like PyCharm.
72+
73+ #### Coverage
74+ To check the coverage of the tests execute
75+
76+ ```bash
77+ coverage run -m pytest -v
78+ ```
79+
80+ To get a report table
81+
82+ ``` bash
83+ coverage report
84+ ```
85+
86+ To get a full report in html
87+ ``` bash
88+ coverage html
89+ ```
90+ Then check in the [ htmlcov/index.html] ( ./htmlcov/index.html ) to see it
91+
92+ If you want that previously collected coverage data is erased, you can execute:
93+
94+ ```
95+ coverage erase
96+ ```
97+
98+ ### CLI
5499
55100There are available commands, aware of the API, that can be very helpful to you. You
56101can check them out by running
@@ -64,4 +109,20 @@ as well as its correspondent options.
64109
65110```
66111python cli.py gen_swagger_json -f ~/Downloads/swagger.json
67- ```
112+ ```
113+
114+ ## Built with
115+ - [ Python version 3] ( https://www.python.org/download/releases/3.0/ ) as backend programming language. Strong typing for
116+ the win.
117+ - [ Flask] ( http://flask.pocoo.org/ ) as the micro framework of choice.
118+ - [ Flask RestPlus] ( https://flask-restplus.readthedocs.io/en/stable/ ) for building Restful APIs with Swagger.
119+ - [ Pytest] ( https://docs.pytest.org/en/latest/index.html ) for tests
120+ - [ Coverage] ( https://coverage.readthedocs.io/en/coverage-4.5.4/ ) for coverage
121+ - [ Swagger] ( https://swagger.io/ ) for documentation and standardization, taking into account the
122+ [ API import restrictions and known issues] ( https://docs.microsoft.com/en-us/azure/api-management/api-management-api-import-restrictions )
123+ in Azure.
124+
125+
126+ ## License
127+
128+ Copyright 2020 ioet Inc. All Rights Reserved.
0 commit comments