~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/browser/tests/test_person_view.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2012-01-04 22:30:45 UTC
  • mfrom: (14617.4.4 use-people-where-possible)
  • Revision ID: launchpad@pqm.canonical.com-20120104223045-vinsdew4chhym4ri
[r=sinzui][no-qa] Switch most tests to use Persons instead of
        Accounts. We don't support personless accounts any more.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2009-2012 Canonical Ltd.  This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
3
 
4
4
__metaclass__ = type
399
399
 
400
400
    def test_add_email_address_taken(self):
401
401
        email_address = self.factory.getUniqueEmailAddress()
402
 
        self.factory.makeAccount(
 
402
        self.factory.makePerson(
 
403
            name='deadaccount',
403
404
            displayname='deadaccount',
404
405
            email=email_address,
405
 
            status=AccountStatus.NOACCOUNT)
 
406
            account_status=AccountStatus.NOACCOUNT)
406
407
        form = {
407
408
            'field.VALIDATED_SELECTED': self.valid_email_address,
408
409
            'field.VALIDATED_SELECTED-empty-marker': 1,
411
412
            }
412
413
        view = create_initialized_view(self.person, "+editemails", form=form)
413
414
        error_msg = view.errors[0]
414
 
        expected_msg = ("The email address '%s' is already registered to an "
415
 
                        "account, deadaccount." % email_address)
 
415
        expected_msg = (
 
416
            "The email address '%s' is already registered to "
 
417
            "<a href=\"http://launchpad.dev/~deadaccount\">deadaccount</a>. "
 
418
            "If you think that is a duplicated account, you can "
 
419
            "<a href=\"http://launchpad.dev/people/+requestmerge?"
 
420
            "field.dupe_person=deadaccount\">merge it</a> into your account."
 
421
            % email_address)
416
422
        self.assertEqual(expected_msg, error_msg)
417
423
 
418
424
 
445
451
 
446
452
    def test_validate_email_catches_taken_emails(self):
447
453
        email_address = self.factory.getUniqueEmailAddress()
448
 
        self.factory.makeAccount(
 
454
        self.factory.makePerson(
 
455
            name='libertylandaccount',
449
456
            displayname='libertylandaccount',
450
457
            email=email_address,
451
 
            status=AccountStatus.NOACCOUNT)
 
458
            account_status=AccountStatus.NOACCOUNT)
452
459
        form = {
453
460
            'field.actions.create': 'Create Team',
454
461
            'field.contactemail': email_address,
461
468
            }
462
469
        person_set = getUtility(IPersonSet)
463
470
        view = create_initialized_view(person_set, '+newteam', form=form)
464
 
        expected_msg = ('%s is already registered in Launchpad and is '
465
 
                        'associated with the libertylandaccount '
466
 
                        'account.' % email_address)
 
471
        expected_msg = (
 
472
            '%s is already registered in Launchpad and is associated with '
 
473
            '<a href="http://launchpad.dev/~libertylandaccount">'
 
474
            'libertylandaccount</a>.' % email_address)
467
475
        error_msg = view.errors[0].errors[0]
468
476
        self.assertEqual(expected_msg, error_msg)
469
477