Skip to content

Commit

Permalink
Fix: Test Case Logout issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Niush committed Jul 13, 2021
1 parent bce72cc commit a7f4941
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion api/tests/test_image_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ def test_image_created(self):
self.assertEqual(Image.objects.count(), 1)

def test_image_file_created(self):
print("image file test pass")
self.assertEqual(ImageFile.objects.count(), 1)
3 changes: 3 additions & 0 deletions isac_simo/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from datetime import timedelta
import dj_database_url
import environ
import sys
from isac_simo.database_settings import database_config

env = environ.Env()
Expand All @@ -22,6 +23,8 @@

VERSION = '1.3.2'

TESTING = len(sys.argv) > 1 and sys.argv[1] == 'test'

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

Expand Down
2 changes: 1 addition & 1 deletion main/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __call__(self, instance, filename):
# USER LOGOUT SIGNAL (Shows is_active=False users a special message)
@receiver(user_logged_out)
def post_logout(sender, user, request, **kwargs):
if not user.is_anonymous and not user.active:
if user and not user.is_anonymous and not user.active and not settings.TESTING:
messages.success(request, 'User Account has been Disabled. Please contact ISAC-SIMO Admin.')

class UserManager(BaseUserManager):
Expand Down

0 comments on commit a7f4941

Please sign in to comment.