Remove Person.objects.by_username/by_email for now - they aren't actually in use, the email one looks suspicious in that it takes the email from the User object, and the username one does not seem generally useful; also remove the unit tests of these two which was relying on an incomplete fixture
- Legacy-Id: 7029
This commit is contained in:
parent
fa489ce37a
commit
3fa1834986
|
@ -72,22 +72,7 @@ class PersonInfo(models.Model):
|
|||
class Meta:
|
||||
abstract = True
|
||||
|
||||
class PersonManager(models.Manager):
|
||||
def by_email(self, email):
|
||||
results = self.get_query_set().filter(user__email = email)
|
||||
if len(results)>0:
|
||||
return results[0]
|
||||
else:
|
||||
return None
|
||||
def by_username(self, username):
|
||||
results = self.get_query_set().filter(user__username = username)
|
||||
if len(results)>0:
|
||||
return results[0]
|
||||
else:
|
||||
return None
|
||||
|
||||
class Person(PersonInfo):
|
||||
objects = PersonManager()
|
||||
user = models.OneToOneField(User, blank=True, null=True)
|
||||
|
||||
#this variable, if not None, may be used by url() to keep the sitefqdn.
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
from persons import PersonFetchTestCase
|
|
@ -1,25 +0,0 @@
|
|||
import sys
|
||||
from ietf.utils import TestCase
|
||||
from ietf.group.models import Group
|
||||
from ietf.person.models import Person
|
||||
|
||||
class PersonFetchTestCase(TestCase):
|
||||
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
|
||||
perma_fixtures = [ 'persons']
|
||||
|
||||
def test_FindNoPerson(self):
|
||||
one = Person.objects.by_email('wlo@amsl.org')
|
||||
self.assertEqual(one, None)
|
||||
|
||||
def test_FindOnePerson(self):
|
||||
one = Person.objects.by_email('wlo@amsl.com')
|
||||
self.assertNotEqual(one, None)
|
||||
|
||||
def test_FindOnePersonByUsername(self):
|
||||
one = Person.objects.by_username('wnl')
|
||||
self.assertNotEqual(one, None)
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in a new issue