Skip to content

Commit

Permalink
Hash passwords for tests.
Browse files Browse the repository at this point in the history
Make method static to remove warning.
Add/remove spaces for PEP-8 compliance.
  • Loading branch information
JamesBradbury committed Feb 22, 2018
1 parent 445b4e1 commit 8271bcf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions geokey/users/models.py
Expand Up @@ -68,6 +68,7 @@ class UserGroup(FilterMixin, models.Model):
"""
A user gropup assigned to a project.
"""
objects = None
name = models.CharField(max_length=100)
description = models.TextField(blank=True, null=True)
users = models.ManyToManyField(settings.AUTH_USER_MODEL)
Expand Down
11 changes: 7 additions & 4 deletions geokey/users/tests/test_views.py
Expand Up @@ -48,7 +48,8 @@

class IndexTest(TestCase):

def get(self, user):
@staticmethod
def get(user):
factory = RequestFactory()
view = Index.as_view()
url = reverse('admin:index')
Expand Down Expand Up @@ -1078,7 +1079,8 @@ def test_get_with_anonymous(self):
@override_settings(SOCIALACCOUNT_AUTO_SIGNUP=True,
ACCOUNT_EMAIL_VERIFICATION='none')
def test_get_with_user(self):
user = UserFactory.create(password='myPassword2016')
hashed_password = hashers.make_password(password='myPassword2016')
user = UserFactory.create(password=hashed_password, )

social_account = SocialAccount.objects.create(
user=user,
Expand Down Expand Up @@ -1202,7 +1204,8 @@ def test_get_with_user_when_no_password(self):
@override_settings(SOCIALACCOUNT_AUTO_SIGNUP=True,
ACCOUNT_EMAIL_VERIFICATION='mandatory')
def test_get_with_user_when_email_not_verified(self):
user = UserFactory.create(password='myPassword2016', )
hashed_password = hashers.make_password(password='myPassword2016')
user = UserFactory.create(password=hashed_password, )

social_account = SocialAccount.objects.create(
user=user,
Expand Down Expand Up @@ -1489,6 +1492,7 @@ def test_add_contributor_with_non_member(self):
self.contributors.users.all()
)


class UserGroupSingleUserTest(TestCase):

def setUp(self):
Expand Down Expand Up @@ -1600,7 +1604,6 @@ def test_delete_contributor_with_non_member(self):
)



class ChangePasswordTest(TestCase):

def test_changepassword(self):
Expand Down

0 comments on commit 8271bcf

Please sign in to comment.