def radpress_full_name(user): if not isinstance(user, get_user_model()): full_name = '' else: full_name = user.get_full_name() if not full_name: full_name = user.username return full_name
import os.path from django.core.urlresolvers import reverse from django.template import Context, Template from django.template.defaultfilters import slugify from django.test import TestCase from django.test.client import Client from radpress.compat import get_user_model User = get_user_model() from radpress.models import Article, Page, Tag from radpress.readers import get_reader from radpress.settings import CONTEXT_DATA, MORE_TAG from radpress.templatetags.radpress_tags import radpress_get_url class RadpressTestCase(TestCase): fixtures = [os.path.join(os.path.dirname(__file__), 'data.json')] def setUp(self): self.client = Client() # define article self.article1 = Article.objects.get(pk=1) # define user self.user1 = User.objects.get(username='******') self.user1.set_password('secret') self.user1.save() # define second user password self.user2 = User.objects.get(username='******')