Skip to content

Commit f281932

Browse files
committed
fixed test files to run with a single command, and work with current migrations
1 parent 3135dd6 commit f281932

File tree

5 files changed

+4
-12
lines changed

5 files changed

+4
-12
lines changed

accounts/tests.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

accounts/tests/test_requests/__init__.py

Whitespace-only changes.

accounts/tests/test_requests/test_users.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@ def test_patient_current_user_get(self):
1414
"""
1515
Ensure we get a user.
1616
"""
17-
user = User.objects.create(username="helloworld")
18-
1917
response = self.client.get("/services/api/users",
2018
content_type=self.content_type)
2119

2220
response.status_code.should.equal(200)
2321

2422
response_data = json.loads(response.content)
2523
attributes = json.loads(response.content)['data'][0]['attributes']
26-
attributes['username'].should.equal(user.username)
24+
attributes['username'].should.equal('codecorgi')

profile/tests/test_requests/__init__.py

Whitespace-only changes.

profile/tests/test_requests/test_profile.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from django.test import TestCase
22
from rest_framework.test import APIClient, APITestCase
3-
from accounts.models import User
43
from profile.models import Profile, ProfileURL
54
import sure
65
import json
@@ -14,9 +13,8 @@ def test_profile_create_with_user(self):
1413
"""
1514
Ensure we get the correct profile
1615
"""
17-
user = User.objects.create(username="husky")
1816

19-
profile = Profile.objects.create(user=user, bio="Woof!")
17+
profile = Profile.objects.filter().last()
2018

2119
response = self.client.get("/services/api/profiles",
2220
content_type=self.content_type)
@@ -27,15 +25,14 @@ def test_profile_create_with_user(self):
2725
attributes = response_data['data'][0]['attributes']
2826
relationships = response_data['data'][0]['relationships']
2927
attributes['bio'].should.equal(profile.bio)
30-
relationships['user']['data']['id'].should.equal(str(user.id))
28+
relationships['user']['data']['id'].should.equal(str(profile.user.id))
3129

3230
def test_profile_create_with_urls(self):
3331
"""
3432
Ensure we get the correct profile and project urls
3533
"""
36-
user = User.objects.create(username="poodle")
3734

38-
profile = Profile.objects.create(user=user, bio="Woof! in French")
35+
profile = Profile.objects.filter().last()
3936

4037
url1 = ProfileURL.objects.create(profile=profile, name='codecorgi', url='https://codecorgi.co')
4138
url2 = ProfileURL.objects.create(profile=profile, name='codecorgi gh', url=None)

0 commit comments

Comments
 (0)