Skip to content

Commit

Permalink
Cleaned up hard coded User model.
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanHayes committed Jan 25, 2016
1 parent 4b67009 commit 597d6e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 3 additions & 5 deletions django_mesh/tests/test_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
# Test imports
from .util import BaseTestCase

from django.contrib.auth import get_user_model

class PostQuerySetTestCase(BaseTestCase):
def test_active(self):
Expand Down Expand Up @@ -267,9 +266,8 @@ def test_only_published_posts_shows_up(self):
self.assertNotIn(self.t2, viewable)

def test_tags_only_show_up_if_user_has_access_to_that_Channel(self):
user = self.user

new_user = get_user_model()
new_user.id = 1
self.c1.save()
self.c3.save() # user does not have access to this channel

Expand All @@ -285,7 +283,7 @@ def test_tags_only_show_up_if_user_has_access_to_that_Channel(self):
self.p1.tags.add(self.t1)
self.p2.tags.add(self.t2)

viewable = Tag.objects.get_for_user(new_user)
viewable = Tag.objects.get_for_user(user)

self.assertIn(self.t1, viewable)
self.assertNotIn(self.t2, viewable)
self.assertNotIn(self.t2, viewable)
6 changes: 5 additions & 1 deletion django_mesh/tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#Django imports
from django.test import TestCase
from django.contrib.auth.models import User
from django.contrib.auth import get_user_model
from django.contrib.sites.models import Site
from django.core.cache import cache
from django.utils import timezone
Expand All @@ -29,6 +29,10 @@
from .. import models
from ..models import Channel, Post, Tag


User = get_user_model()


class BaseTestCase(TestCase):
def setUp(self):

Expand Down

0 comments on commit 597d6e8

Please sign in to comment.