Skip to content

Commit

Permalink
Start signals development
Browse files Browse the repository at this point in the history
  • Loading branch information
juliolugo96 committed May 31, 2019
1 parent 7e1ad79 commit 0310f3f
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 11 deletions.
30 changes: 22 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,25 @@ Application Programming Interface built under Django Rest Framework. It's used i

### Run in development environment

1. Open `settings.py` file.
2. Export `DJANGO_DB_NAME`, `DJANGO_USERNAME` and `DJANGO_PASSWORD` with your corresponding
PostgreSQL Database configuration.
3. Go to `api-projex` folder.
4. Activate virtual environment using `source virt-env/bin/activate`.
5. Install all required packages using `pip install -r requirements.txt`.
6. Run migrations using `python manage.py migrate`.
7. Start app using `python manage.py runserver`.
1. Open `set-env` file and modify it as follows:

``` shell
# Change this

source virt-env/bin/activate
export DJANGO_DB_NAME="api-projex"
export DJANGO_USERNAME="julio"
export DJANGO_PASSWORD="12345678"

# ..to this

source virt-env/bin/activate
export DJANGO_DB_NAME="YOUR DATABASE NAME"
export DJANGO_USERNAME="YOUR DATABASE USERNAME"
export DJANGO_PASSWORD="YOUR DATABASE PASSWORD"

```
2. Activate virtual environment and export environment variables using `source set-env`.
3. Install all required packages using `pip install -r requirements.txt`.
4. Run migrations using `python manage.py migrate`.
5. Start app using `python manage.py runserver`.
Binary file modified api/__pycache__/serializers.cpython-35.pyc
Binary file not shown.
1 change: 1 addition & 0 deletions api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def create(self, validated_data):


class TaskSerializer(serializers.ModelSerializer):

class Meta:
model = Task
fields = ('id', 'title', 'description', 'due_date',
Expand Down
3 changes: 0 additions & 3 deletions api/tests.py

This file was deleted.

Empty file added api/tests/__init__.py
Empty file.
17 changes: 17 additions & 0 deletions api/tests/test_views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from django.test import TestCase, Client
from rest_framework.test import APIClient, APIRequestFactory, APITestCase
from rest_framework import status
from api.models import Project
import json

class APIWrapperClass(APITestCase):

def setUp(self):
self.factory = APIRequestFactory()
self.client = APIClient()
url = '/api/v1/api-token-auth/'
response = self.client.post(url, {'username_or_email':'pepe@pepe.com', 'password':'12345678ju'}, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertTrue('token' in response.data)
token = response.data['token']
self.client.credentials(HTTP_AUTHORIZATION='Bearer ' + token)

0 comments on commit 0310f3f

Please sign in to comment.