Skip to content

Commit e76043c

Browse files
committed
refactor tests, update readme
1 parent 8ee78b1 commit e76043c

2 files changed

Lines changed: 17 additions & 16 deletions

File tree

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,27 @@ A flask-driven restful API for Bucketlist interactions
1515
* If you wish to run your own build, first ensure you have python3 globally installed in your computer. If not, you can get python3 [here](https://www.python.org).
1616
* After this, ensure you have installed virtualenv globally as well. If not, run this:
1717

18-
```
19-
pip install virtualenv
18+
```bash
19+
pip install virtualenv
2020
```
2121

2222
* Git clone this repo
2323

24-
```
25-
git clone git@github.com:gitgik/flask-rest-api.git
24+
```bash
25+
git clone git@github.com:gitgik/flask-rest-api.git
2626
```
2727

2828
* ### Dependencies
2929

3030
1. Cd into your the cloned repo:
3131

32-
```
32+
```bash
3333
cd flask-rest-api
3434
```
3535

3636
2. Create and get into your virtual environment:
3737

38-
```
38+
```bash
3939
virtualenv -p python3 venv
4040
source venv/bin/activate
4141
```
@@ -44,13 +44,13 @@ A flask-driven restful API for Bucketlist interactions
4444

4545
Install [Dotenv](https://pypi.org/project/python-dotenv/) as follows:
4646

47-
```
47+
```bash
4848
pip install python-dotenv
4949
```
5050

5151
Create a .env file and add the following:
5252

53-
```
53+
```bash
5454
SECRET="some-very-long-string-of-random-characters-CHANGE-TO-YOUR-LIKING"
5555
APP_SETTINGS="development"
5656
DATABASE_URL="postgresql://localhost/flask_api"
@@ -60,44 +60,44 @@ A flask-driven restful API for Bucketlist interactions
6060

6161
* ### Install your requirements
6262

63-
```
63+
```bash
6464
(venv)$ pip install -r requirements.txt
6565
```
6666

6767
* ### Database Migrations
6868

6969
Make sure your postgresql server is running. Then, on your psql console, create your database:
7070

71-
```
71+
```bash
7272
$ psql -U postgres
7373
> CREATE DATABASE flask_api;
7474
```
7575

7676
In the project directory, make and apply your Migrations
7777

78-
```
78+
```bash
7979
(venv)$ flask db init
8080
8181
(venv)$ flask db migrate
8282
```
8383

8484
And finally, migrate to persist them on the database
8585

86-
```
86+
```bash
8787
(venv)$ flask db upgrade
8888
```
8989

9090
* ### Running the Server
9191

9292
On your terminal, run the server using this one simple command:
9393

94-
```
94+
```bash
9595
(venv)$ flask run
9696
```
9797

9898
You can now access the app on your local browser by using
9999

100-
```
100+
```bash
101101
http://localhost:5000/bucketlists/
102102
```
103103

tests/test_bucketlist.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def test_bucketlist_creation(self):
4444
'/bucketlists/',
4545
headers=dict(Authorization="Bearer " + access_token),
4646
data=self.bucketlist)
47+
4748
self.assertEqual(res.status_code, 201)
4849
self.assertIn('Go to Borabora', str(res.data))
4950

@@ -55,12 +56,12 @@ def test_api_can_get_all_bucketlists(self):
5556

5657
res = self.client().post(
5758
'/bucketlists/',
58-
headers=dict(Authorization="Bearer " + access_token),
59+
headers={'Authorization': "Bearer " + access_token},
5960
data=self.bucketlist)
6061
self.assertEqual(res.status_code, 201)
6162
res = self.client().get(
6263
'/bucketlists/',
63-
headers=dict(Authorization="Bearer " + access_token),
64+
headers={'Authorization': "Bearer " + access_token},
6465
)
6566
self.assertEqual(res.status_code, 200)
6667
self.assertIn('Go to Borabora', str(res.data))

0 commit comments

Comments
 (0)