def test_getOrCreateSoftwareCenterCustomer_rejects_suspended(self): # Suspended accounts are not returned. with admin_logged_in(): existing = self.factory.makePerson( email='*****@*****.**', account_status=AccountStatus.SUSPENDED) oid = OpenIdIdentifier() oid.account = existing.account oid.identifier = u'somebody' Store.of(existing).add(oid) sca = getUtility(IPersonSet).getByName('software-center-agent') response = self.getOrCreateSoftwareCenterCustomer(sca) self.assertEqual(400, response.status)
def new(self, rationale, displayname, openid_identifier=None): """See `IAccountSet`.""" account = Account( displayname=displayname, creation_rationale=rationale) # Create an OpenIdIdentifier record if requested. if openid_identifier is not None: assert isinstance(openid_identifier, unicode) identifier = OpenIdIdentifier() identifier.account = account identifier.identifier = openid_identifier IMasterStore(OpenIdIdentifier).add(identifier) return account
def new(self, rationale, displayname, openid_identifier=None): """See `IAccountSet`.""" account = Account(displayname=displayname, creation_rationale=rationale) # Create an OpenIdIdentifier record if requested. if openid_identifier is not None: assert isinstance(openid_identifier, unicode) identifier = OpenIdIdentifier() identifier.account = account identifier.identifier = openid_identifier IMasterStore(OpenIdIdentifier).add(identifier) return account
def new(self, rationale, displayname, openid_identifier=None, status=AccountStatus.NOACCOUNT): """See `IAccountSet`.""" assert status in (AccountStatus.NOACCOUNT, AccountStatus.PLACEHOLDER) account = Account(displayname=displayname, creation_rationale=rationale, status=status) # Create an OpenIdIdentifier record if requested. if openid_identifier is not None: assert isinstance(openid_identifier, unicode) identifier = OpenIdIdentifier() identifier.account = account identifier.identifier = openid_identifier IMasterStore(OpenIdIdentifier).add(identifier) return account
def makeOpenIdIdentifier(self, account, identifier): openid_identifier = OpenIdIdentifier() openid_identifier.identifier = identifier openid_identifier.account = account return self.store.add(openid_identifier)