Skip to content

Commit

Permalink
Fixed flake8
Browse files Browse the repository at this point in the history
Signed-off-by: Macartur Sousa <macartur.sc@gmail.com>
  • Loading branch information
macartur committed May 17, 2016
1 parent f1c7d16 commit 7a3a1c5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
14 changes: 7 additions & 7 deletions colab/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
from django.utils.translation import ugettext_lazy as _

from .signals import (user_created, user_password_changed,
user_basic_info_updated, delete_user)
user_basic_info_updated)
# from .signals import delete_user

from .utils import mailman


Expand Down Expand Up @@ -94,15 +96,13 @@ def set_password(self, raw_password):
user_password_changed.send(User, user=self, password=raw_password)

def delete(self, using=None):

emails = " ".join(self.emails.values_list('address', flat=True))
super(User, self).delete(using)


#TODO:
# TODO:
# To maintain to integrity of the database we should deactive the user
# instead of delete. Or we will lose some data.

# emails = " ".join(self.emails.values_list('address', flat=True))
super(User, self).delete(using)

# user = User.objects.filter(id=self.id)
# if not user:
# delete_user.send(User, user=self, emails=emails)
Expand Down
42 changes: 21 additions & 21 deletions colab/super_archives/tests/test_signals.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# -*- coding:utf-8 -*-

from mock import patch
# from mock import patch

from colab.accounts.models import User
from django.test import TestCase
from colab.super_archives.models import EmailAddress
# from colab.super_archives.models import EmailAddress


class SignalsTest(TestCase):
Expand All @@ -23,22 +23,22 @@ def create_user(self):

return user

#TODO: see colab/accounts/models.py before uncomment this lines
#@patch.object(User, 'update_subscription')
#def test_delete_user_without_email(self, update_subscription_mock):
# update_subscription_mock.return_value = True
# self.user.delete()
# self.assertEqual(0, update_subscription_mock.call_count)

#@patch.object(User, 'update_subscription')
#def test_delete_user_with_email(self, update_subscription_mock):
# update_subscription_mock.return_value = True

# EmailAddress.objects.get_or_create(user=self.user,
# address="usertest@colab.com.br")
# EmailAddress.objects.get_or_create(user=self.user,
# address="teste@gmail.com")

# self.user.delete()
# self.assertEqual(2, update_subscription_mock.call_count)
# self.assertEqual(0, EmailAddress.objects.count())
# TODO: see colab/accounts/models.py before uncomment this lines
# @patch.object(User, 'update_subscription')
# def test_delete_user_without_email(self, update_subscription_mock):
# update_subscription_mock.return_value = True
# self.user.delete()
# self.assertEqual(0, update_subscription_mock.call_count)

# @patch.object(User, 'update_subscription')
# def test_delete_user_with_email(self, update_subscription_mock):
# update_subscription_mock.return_value = True

# EmailAddress.objects.get_or_create(user=self.user,
# address="usertest@colab.com.br")
# EmailAddress.objects.get_or_create(user=self.user,
# address="teste@gmail.com")

# self.user.delete()
# self.assertEqual(2, update_subscription_mock.call_count)
# self.assertEqual(0, EmailAddress.objects.count())

0 comments on commit 7a3a1c5

Please sign in to comment.