|
1 | 1 | # Contributing |
2 | 2 |
|
3 | | -I am accepting pull requests. Sometimes life gets busy and it takes me a little while to get everything merged in. To help speed up the process, please write tests to cover your changes. I will review/merge them as soon as possible. |
| 3 | +I am accepting pull requests. Sometimes life gets busy and it takes me a little while to get everything reviewed and merged in. To help speed up the process, please write tests to cover your changes. I will review/merge them as soon as possible. |
4 | 4 |
|
5 | 5 | # Testing |
6 | 6 |
|
7 | | -I use [nose](https://nose.readthedocs.io/en/latest/index.html) and [Coverage](https://coverage.readthedocs.io/en/latest/) to run the test suite. |
| 7 | +I use [pytest](https://docs.pytest.org/en/7.4.x/contents.html), [Coverage](https://coverage.readthedocs.io/en/latest/), and [pytest-cov](https://pytest-cov.readthedocs.io/en/latest/) to run the test suite. |
8 | 8 |
|
9 | 9 | *WARNING*: The Tests connect to the QBO API and create/modify/delete data. DO NOT USE A PRODUCTION ACCOUNT! |
10 | 10 |
|
11 | 11 | ## Testing setup: |
12 | 12 |
|
13 | 13 | 1. Create/login into your [Intuit Developer account](https://developer.intuit.com). |
14 | 14 | 2. On your Intuit Developer account, create a Sandbox company and an App. |
15 | | -3. Go to the Intuit Developer OAuth 2.0 Playground and fill out the form to get an **access token** and **refresh token**. You will need to copy the following values into your enviroment variables: |
| 15 | +3. Go to the Intuit Developer OAuth 2.0 Playground and fill out the form to get a **refresh token**. You will need to copy the following values into your enviroment variables: |
16 | 16 | ``` |
17 | 17 | export CLIENT_ID="<Client ID>" |
18 | 18 | export CLIENT_SECRET="<Client Secret>" |
19 | | - export COMPANY_ID="<Realm ID>" |
20 | | - export ACCESS_TOKEN="<Access token>" |
| 19 | + export COMPANY_ID="<Realm ID>" |
21 | 20 | export REFRESH_TOKEN="<Refresh token>" |
22 | 21 | ``` |
23 | 22 |
|
24 | | - *Note*: You will need to update the access token when it expires. |
| 23 | + *Note*: You will need to update the refresh token when it expires. |
25 | 24 |
|
26 | | -5. Install *nose* and *coverage*. Using Pip: |
27 | | - `pip install nose coverage` |
| 25 | +5. Install *pytest*, *coverage*, and *pytest-cov*. Using Pip (or whatever): |
| 26 | + `pip install pytest coverage pytest-cov` |
28 | 27 |
|
29 | | -6. Run `nosetests . --with-coverage --cover-package=quickbooks` |
| 28 | +6. Run all tests: ```pytest --cov``` |
| 29 | + Run only unit tests: ```pytest tests/unit --cov``` |
| 30 | + Run only integration tests: ```pytest tests/intergration --cov``` |
| 31 | + |
| 32 | + |
30 | 33 |
|
31 | 34 | ## Creating new tests |
32 | 35 | Normal Unit tests that do not connect to the QBO API should be located under `test/unit` Test that connect to QBO API should go under `tests/integration`. Inheriting from `QuickbooksTestCase` will automatically setup `self.qb_client` to use when connecting to QBO. |
|
0 commit comments