-
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.
Merge branch 'ch-setup-travis-165273464' of https://github.com/andela…
…/ah-backend-invictus into ch-setup-travis-165273464 ch(setup travis): To enable CI of tests through TDD Add travis.yml file Add pytest.ini to setup pytest setting Update the requirements.txt file Add a badge to the readme file Add tests to test for a user signup Add a name in the authentication url Modify travis file to run the tests Add .coveragerc file to omit some unnecessary file [Starts #165273464]
- Loading branch information
Showing
5 changed files
with
49 additions
and
3 deletions.
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
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