Exemplo n.º 1
0
 def test_by_reporting_org_ref(self):
     trans_in = fac.TransactionFactory.create(
         activity=fac.ActivityFactory.build(reporting_org__ref=u"AAA"))
     trans_not = fac.TransactionFactory.create(
         activity=fac.ActivityFactory.build(reporting_org__ref=u"ZZZ"))
     transactions = dsfilter.transactions({"reporting-org": u"AAA"})
     self.assertIn(trans_in, transactions.all())
     self.assertNotIn(trans_not, transactions.all())
Exemplo n.º 2
0
 def test_by_reporting_org_ref(self):
     trans_in = fac.TransactionFactory.create(
         activity=fac.ActivityFactory.build(reporting_org__ref=u"AAA"))
     trans_not = fac.TransactionFactory.create(
         activity=fac.ActivityFactory.build(reporting_org__ref=u"ZZZ"))
     transactions = dsfilter.transactions({
         "reporting-org": u"AAA"
     })
     self.assertIn(trans_in, transactions.all())
     self.assertNotIn(trans_not, transactions.all())
Exemplo n.º 3
0
    def test_by_provider_org_activity_id(self):
        trans_in = fac.TransactionFactory.create(
			provider_org_activity_id=u"AAA")
        trans_not = fac.TransactionFactory.create(
			provider_org_activity_id=u"ZZZ")
        transactions = dsfilter.transactions({
            "transaction_provider-org.provider-activity-id": u"AAA"
        })
        self.assertIn(trans_in, transactions.all())
        self.assertNotIn(trans_not, transactions.all())
Exemplo n.º 4
0
    def test_by_participating_org_ref(self):
        trans_in = fac.TransactionFactory.create(
            activity=fac.ActivityFactory.build(participating_orgs=[
                fac.ParticipationFactory.build(organisation__ref=u"AAA")
            ]))
        trans_not = fac.TransactionFactory.create(
            activity=fac.ActivityFactory.build(participating_orgs=[
                fac.ParticipationFactory.build(organisation__ref=u"ZZZ")
            ]))

        transactions = dsfilter.transactions({"participating-org": u"AAA"})
        self.assertIn(trans_in, transactions.all())
        self.assertNotIn(trans_not, transactions.all())
Exemplo n.º 5
0
 def test_by_country_code(self):
     trans_in = fac.TransactionFactory.create(
         activity=fac.ActivityFactory.build(recipient_country_percentages=[
             fac.CountryPercentageFactory.build(country=cl.Country.libya),
         ]))
     trans_not = fac.TransactionFactory.create(
         activity=fac.ActivityFactory.build(recipient_country_percentages=[
             fac.CountryPercentageFactory.build(country=cl.Country.zambia),
         ]))
     transactions = dsfilter.transactions(
         {"recipient-country": cl.Country.from_string(u"LY")})
     self.assertIn(trans_in, transactions.all())
     self.assertNotIn(trans_not, transactions.all())
Exemplo n.º 6
0
    def test_by_participating_org_text(self):
        trans_in = fac.TransactionFactory.create(
            activity=fac.ActivityFactory.build(
                participating_orgs=[
                    fac.ParticipationFactory.build(
                        organisation__ref=u"AAA", organisation__name=u"aaa")
                ]))
        trans_not = fac.TransactionFactory.create(
            activity=fac.ActivityFactory.build(
                participating_orgs=[
                    fac.ParticipationFactory.build(
                        organisation__ref=u"ZZZ", organisation__name=u"zzz")
                ]))

        transactions = dsfilter.transactions({
            "participating-org.text": u"aaa"
        })
        self.assertIn(trans_in, transactions.all())
        self.assertNotIn(trans_not, transactions.all())
Exemplo n.º 7
0
 def test_by_country_code(self):
     trans_in = fac.TransactionFactory.create(
         activity=fac.ActivityFactory.build(
             recipient_country_percentages=[
                 fac.CountryPercentageFactory.build(
                     country=cl.Country.libyan_arab_jamahiriya),
             ])
     )
     trans_not = fac.TransactionFactory.create(
         activity=fac.ActivityFactory.build(
             recipient_country_percentages=[
                 fac.CountryPercentageFactory.build(
                     country=cl.Country.zambia),
             ])
     )
     transactions = dsfilter.transactions({
         "recipient-country": cl.Country.from_string(u"LY")
     })
     self.assertIn(trans_in, transactions.all())
     self.assertNotIn(trans_not, transactions.all())