コード例 #1
0
    def setup_unit_and_followers(self, confirmed=True):
        self.unit = models.Unit.objects.create(id='E25')

        self.phone_follower = any_user(id=1, email='*****@*****.**')
        models.update(self.phone_follower.profile, phone='phone_follower #',
                      phone_confirmed=confirmed)
        models.UnitFollower.objects.create(
            unit=self.unit, user=self.phone_follower, by_phone=True)

        self.email_follower = any_user(id=2, email='*****@*****.**')
        models.update(self.email_follower.profile, phone='email_follower #',
                      email_confirmed=confirmed)
        models.UnitFollower.objects.create(
            unit=self.unit, user=self.email_follower, by_email=True)

        self.both_follower = any_user(id=3, email='*****@*****.**')
        models.update(self.both_follower.profile, phone='both_follower #',
                      email_confirmed=confirmed, phone_confirmed=confirmed)
        models.UnitFollower.objects.create(
            unit=self.unit, user=self.both_follower,
            by_email=True, by_phone=True)

        self.neither_follower = any_user(id=4, email='*****@*****.**')
        models.update(self.neither_follower.profile,
                      phone='neither_follower #')
        models.UnitFollower.objects.create(
            unit=self.unit, user=self.neither_follower,
            by_email=False, by_phone=False)