Files
@ 7777a6f70fd5
Branch filter:
Location: rattail-project/rattail/tests/db/model/test_users.py - annotation
7777a6f70fd5
1.4 KiB
text/x-python
Remove deprecated `RattailConfig.getboolean()` method.
All calling code should be refactored, I believe..
All calling code should be refactored, I believe..
c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 c80ff6355318 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from ... import DataTestCase
from rattail.db import model
class TestUserEmailAddress(DataTestCase):
def extra_setup(self):
self.user = model.User(username='fred')
self.session.add(self.user)
self.session.flush()
def test_email_defaults_to_none(self):
self.assertTrue(self.user.get_email_address() is None)
def test_email_comes_from_person_then_customer(self):
# only customer has email at this point
person = model.Person(first_name='Fred')
customer = model.Customer(name='Fred')
customer.add_email_address('customer@mailinator.com')
customer.people.append(person)
self.user.person = person
self.session.flush()
self.assertEqual(self.user.get_email_address(), 'customer@mailinator.com')
# now person email will take preference
person.add_email_address('person@mailinator.com')
self.session.refresh(person)
self.assertEqual(self.user.get_email_address(), 'person@mailinator.com')
def test_email_address_property_works_too(self):
# even though this may go away some day, cover it for now
person = model.Person(first_name='Fred')
person.add_email_address('person@mailinator.com')
self.user.person = person
self.session.flush()
self.assertEqual(self.user.email_address, 'person@mailinator.com')
|