Skip to content

Commit deb51c6

Browse files
author
marter11
committed
tests README
1 parent 33dbbd1 commit deb51c6

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ Install docker-compose and do `docker-compose up`. Don't forget to setup your
4040

4141
Your `.env` file should now look something like [example.env](https://github.com/ProgrammingBuddies/programmingbuddies-api/blob/develop/example.env)
4242

43+
### Testing
44+
45+
- to run multiple tests just specify the directory which contains them for example `pipenv run pytest src/tests`
46+
- - this will run all the tests in the `tests` directory
47+
- if you want to run test cases only in a particular file, then just give the full file path `pipenv run pytest src/tests/example.py`
48+
4349
## Milestones
4450
- [ ] build DB and endpoints with basic CRUD
4551
- [ ] add security for app (ie - bots, and non-human actors/clients)

src/tests/api/views/test_projectView.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,21 @@ def test_create_project(self, client):
2929
def test_update_project(self, client):
3030

3131
# project id doesn't exist
32-
response = client.post('/projects/no_id', json={'name': 'Updated PB'})
32+
response = client.post('/projects/0', json={'name': 'Updated PB'})
33+
34+
# notice: should return 404 when doesen't exist insted of 400
3335
assert response.status_code == 404
3436

3537
project_id = self.create_project_for_test_cases()
3638
response = client.post('/projects/{}'.format(project_id), json={'description': 'updated desc'})
3739
project = Project.query.filter_by(id=project_id).first()
3840
assert project.description == 'updated desc'
41+
42+
def test_delete_project(self, client):
43+
response = client.delete('/projects/0')
44+
assert response.status_code == 404
45+
46+
# notice: the project links should be required? if not then the view's response is wrong
47+
# project_id = self.create_project_for_test_cases()
48+
# response = client.delete('/project/{}'.format(project_id))
49+
# assert response.status_code == 202

0 commit comments

Comments
 (0)