def test_get_owners(dummy_guillotina, mock_txn): content = create_content() roleperm = IPrincipalRoleManager(content) roleperm.assign_role_to_principal("guillotina.Owner", "foobar") assert utils.get_owners(content) == ["foobar"] roleperm.assign_role_to_principal("guillotina.Owner", "foobar2") assert utils.get_owners(content) == ["foobar", "foobar2"]
def test_get_owners(dummy_guillotina): content = create_content() roleperm = IPrincipalRoleManager(content) roleperm.assign_role_to_principal('guillotina.Owner', 'foobar') assert utils.get_owners(content) == ['foobar'] roleperm.assign_role_to_principal('guillotina.Owner', 'foobar2') assert utils.get_owners(content) == ['foobar', 'foobar2']
async def __call__(self): data = await super().__call__() data.update({ 'id': self.context.id, 'creation_date': self.context.creation_date, 'text': self.context.text, 'author': get_owners(self.context)[0], 'conversation_id': self.context.__parent__.id }) return data
async def __call__(self): data = await super().__call__() data.update({ #per ora passo l'ID della notifica 'id': self.context.id, 'creation_date': self.context.creation_date, 'modification_date': self.context.modification_date, #serializzo le notifiche 'not_type': self.context.not_type, 'recipientId': self.context.recipientId, 'email_recipient': self.context.email_recipient, 'subject': self.context.subject, 'message': self.context.message, 'application_name': self.context.application_name, 'status': self.context.status, #se volessimo essere precisi: 'author': Django-Freeman 'author': get_owners(self.context)[0] #ma per noi sempre root idealmente }) return data