You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: backend/README.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,13 @@
2
2
3
3
This is the backend for the National Police Data Index project. It is a Python Flask application that serves as the API for the front end.
4
4
5
+
---
6
+
**NOTE:**
7
+
8
+
If you are having trouble running your backend tests for the first time, you might be interested in [this README.md](tests/README.md) rather than this one :-).
9
+
10
+
---
11
+
5
12
## Database
6
13
7
14
The backend uses a PostgreSQL database to store data. The database schema is defined in [database/models](https://github.com/codeforboston/police-data-trust/tree/a743c232b5737b193086264e1364b1475873a884/backend/database/models).
Copy file name to clipboardExpand all lines: backend/tests/README.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,12 +2,12 @@ To run backend tests locally:
2
2
3
3
## Pytest (Unit Tests)
4
4
5
-
1. Start the application cluster with `docker-compose up`
5
+
1. Start the application cluster with `dockercompose up`
6
6
7
-
2. Start the test database with `docker-compose --profile test up`.
7
+
2. Start the test database with `dockercompose --profile test up`.
8
8
Yes, you should start the test database separately. It'll be more likely to boot properly this way.
9
9
10
-
3. Add a test marker to the test DB. This will allow the DB to clear itself after each test run. See instructionsbelow.
10
+
3. Add a test marker to the test DB. This will allow the DB to clear itself after each test run. See instructions[below](#adding-a-test-marker-to-the-test-database).
11
11
12
12
4. Connect to the API container with `docker exec -it "police-data-trust-api-1" /bin/bash`. You can find the container name by running `docker ps`.
13
13
@@ -20,22 +20,22 @@ Yes, you should start the test database separately. It'll be more likely to boot
20
20
21
21
1. With the test database running, navigate to `localhost:7474` in your browser.
22
22
23
-
2. On the Neo4J web interface, select `neo4j://127.0.0.1:7688` as the connection URL. Otherwise, you will connect to the main database.
23
+
2. On the Neo4J web interface, select `neo4j://127.0.0.1:7688` as the connection URL. Otherwise, you will connect to the main database. You can connect to a new DB by typing the following into the command bar at the very top of your browser window: `:server connect neo4j://127.0.0.1:7688` and pressing Enter or clicking the run button. The command bar often starts with `neo4j$ ` at the beginning.
24
24
25
-
3. Log in with the username `neo4j` and the password `test_pwd`.
26
-
27
-
4. Run the following query to add a test marker to the database:
25
+
3. Run the following query to add a test marker to the database:
28
26
29
27
```
30
28
MERGE (n:TestMarker {name: 'TEST_DATABASE'});
31
29
```
32
30
31
+
This command can also be run from the command bar at the top of your screen.
32
+
33
33
5. You can now run the tests. The database will clear itself after each test run.
34
34
35
35
36
36
## Flake8 (Linting)
37
37
38
-
1. Start the application cluster with `docker-compose up`
38
+
1. Start the application cluster with `dockercompose up`
39
39
40
40
2. Connect to the API container with `docker exec -it "police-data-trust-api-1" /bin/bash`. You can find the container name by running `docker ps`.
0 commit comments