def test_find_identity(self):
        farmer = utils.create_farmer()
        identity = farmer.actor.add_identity('1234', '1234')

        self.assertEquals(farmer.actor.get_identity('1234'), identity)
        self.assertEquals(Actor.find('1234'), farmer.actor)
        self.assertEquals(Actor.find_with_pin('1234', '1234'), farmer.actor)
        self.assertRaises(ActorException, Actor.find_with_pin, '1234',
                          'bad-pin')
Exemple #2
0
def is_agent(msisdn):
    try:
        return Actor.find(msisdn).as_agent()
    except Identity.DoesNotExist:
        return False