Ejemplo n.º 1
0
 def setUp(self):
     Harness.setUp(self)
     self.admin = self.make_participant('admin', is_admin=True)
     self.alice = self.make_participant('alice')
     self.gratiteam = self.make_team('gratiteam',
                                     owner='alice',
                                     is_approved=None)
 def setUp(self):
     Harness.setUp(self)
     for username in ['alice', 'bob', 'carl']:
         p = self.make_participant(username,
                                   claimed_time='now',
                                   elsewhere='twitter')
         setattr(self, username, p)
Ejemplo n.º 3
0
 def setUp(self):
     Harness.setUp(self)
     for participant in ['alice', 'bob']:
         p = self.make_participant(participant,
                                   claimed_time='now',
                                   last_bill_result='')
         setattr(self, participant, p)
Ejemplo n.º 4
0
 def setUp(self):
     Harness.setUp(self)
     self.mailer_patcher = mock.patch.object(Participant._mailer.messages, 'send')
     self.mailer = self.mailer_patcher.start()
     self.addCleanup(self.mailer_patcher.stop)
     sleep_patcher = mock.patch('gratipay.models.participant.sleep')
     sleep_patcher.start()
     self.addCleanup(sleep_patcher.stop)
    def setUpClass(cls):
        Harness.setUpClass()
        cls.TT = cls.db.one("SELECT id FROM countries WHERE code='TT'")
        cls.US = cls.db.one("SELECT id FROM countries WHERE code='US'")

        def _failer(info):
            raise ParticipantIdentityInfoInvalid('You failed.')
        identity.schema_validators['impossible'] = _failer
Ejemplo n.º 6
0
    def setUpClass(cls):
        Harness.setUpClass()
        cls.TT = cls.db.one("SELECT id FROM countries WHERE code='TT'")
        cls.US = cls.db.one("SELECT id FROM countries WHERE code='US'")

        def _failer(info):
            raise ParticipantIdentityInfoInvalid('You failed.')
        identity.schema_validators['impossible'] = _failer
Ejemplo n.º 7
0
 def setUp(self):
     Harness.setUp(self)
     self.mailer_patcher = mock.patch.object(Participant._mailer,
                                             'send_email')
     self.mailer = self.mailer_patcher.start()
     self.addCleanup(self.mailer_patcher.stop)
     sleep_patcher = mock.patch('gratipay.models.participant.sleep')
     sleep_patcher.start()
     self.addCleanup(sleep_patcher.stop)
Ejemplo n.º 8
0
    def setUp(self):
        Harness.setUp(self)

        # Alice joins a community.
        self.alice = self.make_participant("alice", claimed_time='now', last_bill_result='')
        self.client.POST( '/for/communities.json'
                        , {'name': 'something', 'is_member': 'true'}
                        , auth_as='alice'
                         )
Ejemplo n.º 9
0
    def setUp(self):
        Harness.setUp(self)

        self.alice = self.make_participant('alice', claimed_time='now')
        self.bob = self.make_participant('bob', claimed_time='now')
        self.carl = self.make_participant('carl', claimed_time='now')
        self.make_exchange('bill', 10, 0, self.alice)
        self.make_exchange('bill', 10, 0, self.bob)
        self.make_participant('notactive', claimed_time='now')

        self.alice.set_tip_to(self.carl, '1.00')
        self.bob.set_tip_to(self.carl, '2.00')
    def setUp(self):
        Harness.setUp(self)

        self.alice = self.make_participant("alice", claimed_time="now")
        self.bob = self.make_participant("bob", claimed_time="now")
        self.carl = self.make_participant("carl", claimed_time="now")
        self.make_exchange("balanced-cc", 10, 0, self.alice)
        self.make_exchange("balanced-cc", 10, 0, self.bob)
        self.make_participant("notactive", claimed_time="now")

        self.alice.set_tip_to(self.carl, "1.00")
        self.bob.set_tip_to(self.carl, "2.00")
Ejemplo n.º 11
0
    def setUp(self):
        Harness.setUp(self)

        # Grab configuration from the environment, storing for later.
        env = wireup.env()
        self.environ = env.environ

        # Change env, doesn't change self.environ.
        env.canonical_scheme = 'https'
        env.canonical_host = 'gratipay.com'

        wireup.canonical(env)
Ejemplo n.º 12
0
    def setUp(self):
        Harness.setUp(self)

        # Grab configuration from the environment, storing for later.
        env = wireup.env()
        self.environ = env.environ

        # Change env, doesn't change self.environ.
        env.canonical_scheme = 'https'
        env.canonical_host = 'gratipay.com'

        wireup.canonical(env)
Ejemplo n.º 13
0
    def setUp(self):
        Harness.setUp(self)

        self.alice = self.make_participant('alice', claimed_time='now')
        self.bob = self.make_participant('bob', claimed_time='now')
        self.carl = self.make_participant('carl', claimed_time='now')
        self.make_exchange('bill', 10, 0, self.alice)
        self.make_exchange('bill', 10, 0, self.bob)
        self.make_participant('notactive', claimed_time='now')

        self.alice.set_tip_to(self.carl, '1.00')
        self.bob.set_tip_to(self.carl, '2.00')
Ejemplo n.º 14
0
    def setUp(self):
        Harness.setUp(self)

        self.alice = self.make_participant('alice', claimed_time='now')
        self.bob = self.make_participant('bob', claimed_time='now')
        self.carl = self.make_participant('carl', claimed_time='now')
        self.make_exchange('balanced-cc', 10, 0, self.alice)
        self.make_exchange('balanced-cc', 10, 0, self.bob)
        self.make_participant('notactive', claimed_time='now')

        return  # XXX upgrade these when you clean up this file
        self.alice.set_tip_to(self.carl, '1.00')
        self.bob.set_tip_to(self.carl, '2.00')
Ejemplo n.º 15
0
    def setUp(self):
        Harness.setUp(self)

        self.alice = self.make_participant('alice', claimed_time='now')
        self.bob = self.make_participant('bob', claimed_time='now')
        self.carl = self.make_participant('carl', claimed_time='now')
        self.make_exchange('balanced-cc', 10, 0, self.alice)
        self.make_exchange('balanced-cc', 10, 0, self.bob)
        self.make_participant('notactive', claimed_time='now')

        return # XXX upgrade these when you clean up this file
        self.alice.set_tip_to(self.carl, '1.00')
        self.bob.set_tip_to(self.carl, '2.00')
Ejemplo n.º 16
0
    def setUp(self):
        Harness.setUp(self)

        self.alice = self.make_participant("alice", claimed_time="now")
        self.bob = self.make_participant("bob", claimed_time="now")
        self.carl = self.make_participant("carl", claimed_time="now")
        self.make_exchange("balanced-cc", 10, 0, self.alice)
        self.make_exchange("balanced-cc", 10, 0, self.bob)
        self.make_participant("notactive", claimed_time="now")

        return  # XXX upgrade these when you clean up this file
        self.alice.set_tip_to(self.carl, "1.00")
        self.bob.set_tip_to(self.carl, "2.00")
Ejemplo n.º 17
0
    def setUp(self):
        Harness.setUp(self)
        now = utcnow()
        hour_ago = now - datetime.timedelta(hours=1)
        for i, username in enumerate(["alice", "bob", "carl"]):
            p = self.make_participant(username, claimed_time=hour_ago, last_bill_result="", balance=Decimal(i))
            setattr(self, username, p)

        deadbeef = self.make_participant("deadbeef", balance=Decimal("18.03"), elsewhere="twitter")
        self.expected_new_balance = self.bob.balance + deadbeef.balance
        deadbeef_twitter = AccountElsewhere.from_user_name("twitter", "deadbeef")

        self.make_tip(self.carl, self.bob, "1.00")
        self.make_tip(self.alice, deadbeef, "1.00")
        self.bob.take_over(deadbeef_twitter, have_confirmation=True)
        self.deadbeef_archived = Participant.from_id(deadbeef.id)
    def setUp(self):
        Harness.setUp(self)
        now = utcnow()
        hour_ago = now - datetime.timedelta(hours=1)
        for i, username in enumerate(['alice', 'bob', 'carl']):
            p = self.make_participant( username
                                     , claimed_time=hour_ago
                                     , last_bill_result=''
                                     , balance=Decimal(i)
                                      )
            setattr(self, username, p)

        deadbeef = self.make_participant('deadbeef', balance=Decimal('18.03'), elsewhere='twitter')
        self.expected_new_balance = self.bob.balance + deadbeef.balance
        deadbeef_twitter = AccountElsewhere.from_user_name('twitter', 'deadbeef')

        self.make_tip(self.carl, self.bob, '1.00')
        self.make_tip(self.alice, deadbeef, '1.00')
        self.bob.take_over(deadbeef_twitter, have_confirmation=True)
        self.deadbeef_archived = Participant.from_id(deadbeef.id)
Ejemplo n.º 19
0
    def setUp(self):
        Harness.setUp(self)
        now = utcnow()
        hour_ago = now - datetime.timedelta(hours=1)
        for i, username in enumerate(['alice', 'bob', 'carl']):
            p = self.make_participant( username
                                     , claimed_time=hour_ago
                                     , last_bill_result=''
                                     , balance=Decimal(i)
                                      )
            setattr(self, username, p)

        deadbeef = self.make_participant('deadbeef', balance=Decimal('18.03'), elsewhere='twitter')
        self.expected_new_balance = self.bob.balance + deadbeef.balance
        deadbeef_twitter = AccountElsewhere.from_user_name('twitter', 'deadbeef')

        self.make_tip(self.carl, self.bob, '1.00')
        self.make_tip(self.alice, deadbeef, '1.00')
        self.bob.take_over(deadbeef_twitter, have_confirmation=True)
        self.deadbeef_archived = Participant.from_id(deadbeef.id)
Ejemplo n.º 20
0
 def make_participant(self, username, **kw):
     take_last_week = kw.pop('take_last_week', None)
     team_name = kw.pop('', TEAM)
     participant = Harness.make_participant(self, username, **kw)
     if take_last_week is not None:
         if self.db.one('SELECT * FROM paydays') is None:
             self.db.run("INSERT INTO paydays DEFAULT VALUES")
         self.db.run( "INSERT INTO transfers (timestamp, tipper, tippee, amount, context) "
                      "VALUES (now(), %(tipper)s, %(tippee)s, %(amount)s, 'take')"
                    , dict(tipper=team_name, tippee=username, amount=take_last_week,)
                     )
         self.db.run("UPDATE paydays SET ts_end=now()")
     return participant
Ejemplo n.º 21
0
 def setUp(self):
     Harness.setUp(self)
     for participant in ['alice', 'bob']:
         p = self.make_participant(participant, claimed_time='now', last_bill_result='')
         setattr(self, participant, p)
Ejemplo n.º 22
0
 def tearDown(self):
     Participant._generate_api_key = self._old
     Harness.tearDown(self)
Ejemplo n.º 23
0
 def setUp(self):
     Harness.setUp(self)
     simplate = self.client.load_resource(b'/about/stats.html')
     self.commaize = simplate.pages[0]['commaize']
Ejemplo n.º 24
0
 def setUp(self):
     Harness.setUp(self)
     self._old_base_url = self.client.website.base_url
     self.client.website.base_url = 'https://gratipay.com'
 def setUp(self):
     Harness.setUp(self)
     self.admin = self.make_participant('admin', is_admin=True)
     self.alice = self.make_participant('alice')
     self.gratiteam = self.make_team('gratiteam', owner='alice', is_approved=None)
Ejemplo n.º 26
0
 def setUp(self):
     Harness.setUp(self)
     self.alice_elsewhere = self.make_elsewhere('twitter', -1, 'alice')
     token, expires = self.alice_elsewhere.make_connect_token()
     self.connect_cookie = {b'connect_%s' % self.alice_elsewhere.id: token}
     self.bob = self.make_participant('bob', claimed_time='now')
 def setUp(self):
     Harness.setUp(self)
     now = utcnow()
     for username in ['alice', 'bob', 'carl']:
         p = self.make_participant(username, claimed_time=now, elsewhere='twitter')
         setattr(self, username, p)
    def setUp(self):
        Harness.setUp(self)

        # Alice joins a community.
        self.alice = self.make_participant("alice", claimed_time="now", last_bill_result="")
        self.client.POST("/for/communities.json", {"name": "something", "is_member": "true"}, auth_as="alice")
Ejemplo n.º 29
0
 def setUp(self):
     Harness.setUp(self)
     make_history(self)
Ejemplo n.º 30
0
 def setUp(self):
     Harness.setUp(self)
     self._old_base_url = self.client.website.base_url
     self.client.website.base_url = "https://gratipay.com"
Ejemplo n.º 31
0
 def setUp(self):
     Harness.setUp(self)
     self.__sleep_for = self.app.email_queue.sleep_for
     self.app.email_queue.sleep_for = 0
Ejemplo n.º 32
0
 def setUp(self):
     Harness.setUp(self)
     self._log_every = self.app.email_queue.log_every
     self.app.email_queue.log_every = 1
 def setUp(self):
     Harness.setUp(self)
     self.admin = self.make_participant("admin", is_admin=True)
     self.alice = self.make_participant("alice")
     self.gratiteam = self.make_team("gratiteam", owner="alice", is_approved=None)
Ejemplo n.º 34
0
 def setUp(self):
     Harness.setUp(self)
     self.team = self.make_participant('A-Team', number='plural')
Ejemplo n.º 35
0
 def setUp(self):
     Harness.setUp(self)
     now = utcnow()
     for username in ["alice", "bob", "carl"]:
         p = self.make_participant(username, claimed_time=now, elsewhere="twitter")
         setattr(self, username, p)
Ejemplo n.º 36
0
 def make_participant(self, *a, **kw):
     kw['claimed_time'] = utcnow()
     return Harness.make_participant(self, *a, **kw)
Ejemplo n.º 37
0
 def setUp(self):
     Harness.setUp(self)
     self.add_participant('alice')
     self.add_participant('bob')
     carl = self.add_participant('carl')
     carl.insert_into_communities(False, 'test', 'test')
Ejemplo n.º 38
0
 def setUp(self):
     Harness.setUp(self)
     self.make_participant('alice', claimed_time='now')
Ejemplo n.º 39
0
 def tearDown(self):
     Harness.tearDown(self)
     reset = Environment(CANONICAL_SCHEME=unicode, CANONICAL_HOST=unicode, environ=self.environ)
     wireup.canonical(reset)
Ejemplo n.º 40
0
 def setUp(self):
     Harness.setUp(self)
     self.alice_elsewhere = self.make_elsewhere('twitter', -1, 'alice')
     token, expires = self.alice_elsewhere.make_connect_token()
     self.connect_cookie = {b'connect_%s' % self.alice_elsewhere.id: token}
     self.bob = self.make_participant('bob', claimed_time='now')
 def setUp(self):
     Harness.setUp(self)
     self.participant = self.make_participant('user1')  # Our protagonist
Ejemplo n.º 42
0
 def setUp(self):
     self._old = Participant._generate_api_key
     seq = itertools.count(0)
     Participant._generate_api_key = lambda self: 'deadbeef{}'.format(next(seq))
     Harness.setUp(self)
Ejemplo n.º 43
0
 def setUp(self):
     Harness.setUp(self)
     self.participant = self.make_participant('user1')  # Our protagonist
Ejemplo n.º 44
0
 def setUp(self):
     Harness.setUp(self)
     self.make_participant('alice')
Ejemplo n.º 45
0
 def make_participant(self, *a, **kw):
     kw['claimed_time'] = utcnow()
     return Harness.make_participant(self, *a, **kw)
Ejemplo n.º 46
0
 def setUp(self):
     Harness.setUp(self)
     simplate = self.client.load_resource(b'/about/stats.html')
     self.commaize = simplate.pages[0]['commaize']
Ejemplo n.º 47
0
 def setUp(self):
     Harness.setUp(self)
     self.make_participant("team", claimed_time=utcnow(), number='plural')
     self.make_participant("alice", claimed_time=utcnow())
Ejemplo n.º 48
0
 def setUp(self):
     Harness.setUp(self)
     self.make_participant("team", claimed_time='now')
     self.make_participant("alice", claimed_time='now')
Ejemplo n.º 49
0
 def tearDown(self):
     self.app.email_queue.log_every = self._log_every
     Harness.tearDown(self)
Ejemplo n.º 50
0
 def tearDown(self):
     Harness.tearDown(self)
     reset = Environment(CANONICAL_SCHEME=unicode, CANONICAL_HOST=unicode, environ=self.environ)
     wireup.canonical(reset)
Ejemplo n.º 51
0
 def setUp(self):
     Harness.setUp(self)
     self.make_participant('alice')
Ejemplo n.º 52
0
 def setUp(self):
     Harness.setUp(self)
     self.bar = self.make_participant('bar', is_admin=True)
Ejemplo n.º 53
0
 def tearDown(self):
     Harness.tearDown(self)
     self.app.email_queue.sleep_for = self.__sleep_for
Ejemplo n.º 54
0
 def setUp(self):
     Harness.setUp(self)
     make_history(self)