Exemplo n.º 1
0
    def test_get_nested_related_none_related(self):
        self.financial_planning.patrimony = self.patrimony

        relationship = Relationship(self.active_client,
                                    related_name='financial_planning')

        with self.assertRaisesMessage(
                AttributeError, "Not possible getting nested related."
                " 'financial_planning' related name got"
                " a None object."):
            relationship.get_nested_related(
                Relationship.RelatedMeta('financial_planning', None),
                Relationship.RelatedMeta('patrimony', None))
Exemplo n.º 2
0
    def test_get_nested_related(self):
        self.active_client.financial_planning = self.financial_planning
        self.financial_planning.patrimony = self.patrimony

        relationship = Relationship(self.active_client,
                                    related_name='financial_planning')

        last_related = relationship.get_nested_related(
            Relationship.RelatedMeta('financial_planning', None),
            Relationship.RelatedMeta('patrimony', None))

        self.assertEqual(last_related, self.patrimony)