-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
126 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[report] | ||
omit = | ||
*/python?.?/* | ||
*/site-packages/nose/* | ||
*/__pycache__/* | ||
*.pyc | ||
*/venv/* | ||
*/home/travis/virtualenv/* | ||
*/usr/lib/python3/* | ||
*/__init__.py | ||
*settings/* | ||
*/settings.py | ||
*migrations/* | ||
*/manage.py | ||
*/urls/* | ||
*/urls.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
language: python | ||
python: | ||
- "3.6" | ||
|
||
services: | ||
- postgresql | ||
|
||
install: | ||
- pip install -r requirements.txt | ||
|
||
before_script: | ||
- psql -c 'create database travis_ci_test;' -U postgres | ||
- python manage.py makemigrations | ||
- python manage.py migrate | ||
|
||
script: | ||
- coverage run --source='authors/apps' manage.py test && coverage report | ||
|
||
after_success: | ||
- coveralls | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Generated by Django 2.1 on 2019-04-23 17:16 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
('auth', '0009_alter_user_last_name_max_length'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='User', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('password', models.CharField(max_length=128, verbose_name='password')), | ||
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), | ||
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), | ||
('username', models.CharField(db_index=True, max_length=255, unique=True)), | ||
('email', models.EmailField(db_index=True, max_length=254, unique=True)), | ||
('is_active', models.BooleanField(default=True)), | ||
('is_staff', models.BooleanField(default=False)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('updated_at', models.DateTimeField(auto_now=True)), | ||
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')), | ||
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"""imports relevant to our tests.""" | ||
import pytest | ||
from django.urls import reverse | ||
from rest_framework import status | ||
from rest_framework.test import APITestCase, APIClient | ||
|
||
|
||
class USERAPITESTCASE(APITestCase): | ||
"""class USERAPI inherits from the APITESTCASE.""" | ||
|
||
def setUp(self): | ||
# Initialize client | ||
self.client = APIClient() | ||
|
||
|
||
class UserSignUp(USERAPITESTCASE): | ||
"""Test user signup.""" | ||
|
||
@pytest.mark.django_db | ||
def test_user_signup(self): | ||
url = reverse('signup') | ||
data = { | ||
"user": { | ||
"username": "james", | ||
"email": "james@gmail.com", | ||
"password": "12345678" | ||
} | ||
} | ||
response = self.client.post(url, data, format="json") | ||
self.assertEqual(response.status_code, status.HTTP_201_CREATED) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[pytest] | ||
DJANGO_SETTINGS_MODULE=authors.settings | ||
addopts = --cov=. --cov-report term-missing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,22 @@ | ||
atomicwrites==1.3.0 | ||
attrs==19.1.0 | ||
certifi==2019.3.9 | ||
chardet==3.0.4 | ||
coverage==4.5.3 | ||
coveralls==1.7.0 | ||
Django==2.1 | ||
django-cors-middleware==1.3.1 | ||
django-extensions==2.1.6 | ||
djangorestframework==3.9.2 | ||
docopt==0.6.2 | ||
idna==2.8 | ||
more-itertools==7.0.0 | ||
pluggy==0.9.0 | ||
py==1.8.0 | ||
PyJWT==1.7.1 | ||
pytest==4.4.1 | ||
pytest-cov==2.6.1 | ||
pytz==2019.1 | ||
requests==2.21.0 | ||
six==1.12.0 | ||
urllib3==1.24.2 |