示例#1
0
    def setUp(self):
        Harness.setUp(self)
        self.alice = self.make_participant('alice', elsewhere='github')

        self.balanced_customer_href = unicode(balanced.Customer().save().href)
        self.card_href = unicode(balanced.Card(
            number='4111111111111111',
            expiration_month=10,
            expiration_year=2020,
            address={
                'line1': "123 Main Street",
                'state': 'Confusion',
                'postal_code': '90210',
            },
            # gittip stores some of the address data in the meta fields,
            # continue using them to support backwards compatibility
            meta={
                'address_2': 'Box 2',
                'city_town': '',
                'region': 'Confusion',
            }
        ).save().href) # XXX Why don't we actually associate this with the customer? See XXX in
                       # test_billing_payday.TestPaydayChargeOnBalanced.
        self.bank_account_href = unicode(balanced.BankAccount(
            name='Homer Jay',
            account_number='112233a',
            routing_number='121042882',
        ).save().href)
 def setUp(self):
     Harness.setUp(self)
     now = utcnow()
     for username in ['alice', 'bob', 'carl']:
         self.make_participant(username,
                               claimed_time=now,
                               elsewhere='twitter')
示例#3
0
    def setUp(self):
        Harness.setUp(self)
        self.alice = self.make_participant('alice', elsewhere='github')

        self.balanced_customer_href = unicode(balanced.Customer().save().href)
        self.card_href = unicode(
            balanced.Card(
                number='4111111111111111',
                expiration_month=10,
                expiration_year=2020,
                address={
                    'line1': "123 Main Street",
                    'state': 'Confusion',
                    'postal_code': '90210',
                },
                # gittip stores some of the address data in the meta fields,
                # continue using them to support backwards compatibility
                meta={
                    'address_2': 'Box 2',
                    'city_town': '',
                    'region': 'Confusion',
                }).save().href
        )  # XXX Why don't we actually associate this with the customer? See XXX in
        # test_billing_payday.TestPaydayChargeOnBalanced.
        self.bank_account_href = unicode(
            balanced.BankAccount(
                name='Homer Jay',
                account_number='112233a',
                routing_number='121042882',
            ).save().href)
示例#4
0
    def setUp(self):
        Harness.setUp(self)

        self._blech = (os.environ["CANONICAL_SCHEME"], os.environ["CANONICAL_HOST"])
        os.environ["CANONICAL_SCHEME"] = "https"
        os.environ["CANONICAL_HOST"] = "www.gittip.com"
        wireup.canonical()
示例#5
0
    def setUp(self):
        Harness.setUp(self)

        self._blech = (os.environ['CANONICAL_SCHEME'],
                       os.environ['CANONICAL_HOST'])
        os.environ['CANONICAL_SCHEME'] = 'https'
        os.environ['CANONICAL_HOST'] = 'www.gittip.com'
        wireup.canonical()
    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'
                         )
示例#7
0
    def setUp(self):
        self.client = TestClient()
        Harness.setUp(self)

        self._blech = ( os.environ['CANONICAL_SCHEME']
                      , os.environ['CANONICAL_HOST']
                       )
        os.environ['CANONICAL_SCHEME'] = 'https'
        os.environ['CANONICAL_HOST'] = 'www.gittip.com'
        wireup.canonical()
示例#8
0
    def setUp(self):
        Harness.setUp(self)
        now = utcnow()
        hour_ago = now - datetime.timedelta(hours=1)
        for username in ["alice", "bob", "carl"]:
            self.make_participant(username, claimed_time=hour_ago, last_bill_result="")
        deadbeef = self.make_elsewhere("twitter", "1", "deadbeef")
        self.deadbeef_original_username = deadbeef.participant.username

        Participant.from_username("carl").set_tip_to("bob", "1.00")
        Participant.from_username("alice").set_tip_to(self.deadbeef_original_username, "1.00")
        Participant.from_username("bob").take_over(deadbeef, have_confirmation=True)
    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 = 'www.gittip.com'

        wireup.canonical(env)
示例#10
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 = 'www.gittip.com'

        wireup.canonical(env)
    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')
    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')
示例#13
0
    def setUp(self):
        Harness.setUp(self)
        now = utcnow()
        hour_ago = now - datetime.timedelta(hours=1)
        for username in ['alice', 'bob', 'carl']:
            p = self.make_participant(username,
                                      claimed_time=hour_ago,
                                      last_bill_result='')
            setattr(self, username, p)
        deadbeef = self.make_elsewhere('twitter', '1', 'deadbeef')
        self.deadbeef_original_username = deadbeef.participant.username

        self.carl.set_tip_to(self.bob, '1.00')
        self.alice.set_tip_to(self.deadbeef_original_username, '1.00')
        self.bob.take_over(deadbeef, have_confirmation=True)
    def setUp(self):
        Harness.setUp(self)
        now = utcnow()
        hour_ago = now - datetime.timedelta(hours=1)
        for username in ['alice', 'bob', 'carl']:
            self.make_participant( username
                                 , claimed_time=hour_ago
                                 , last_bill_result=''
                                  )
        deadbeef = TwitterAccount(self.db, '1', {'screen_name': 'deadbeef'})
        self.deadbeef_original_username = deadbeef.participant

        Participant.from_username('carl').set_tip_to('bob', '1.00')
        Participant.from_username('alice').set_tip_to(self.deadbeef_original_username, '1.00')
        Participant.from_username('bob').take_over(deadbeef, have_confirmation=True)
示例#15
0
    def setUp(self):
        Harness.setUp(self)
        now = utcnow()
        hour_ago = now - datetime.timedelta(hours=1)
        for username in ['alice', 'bob', 'carl']:
            p = self.make_participant( username
                                     , claimed_time=hour_ago
                                     , last_bill_result=''
                                      )
            setattr(self, username, p)
        deadbeef = self.make_elsewhere('twitter', '1', 'deadbeef')
        self.deadbeef_original_username = deadbeef.participant.username

        self.carl.set_tip_to(self.bob, '1.00')
        self.alice.set_tip_to(self.deadbeef_original_username, '1.00')
        self.bob.take_over(deadbeef, have_confirmation=True)
示例#16
0
    def setUp(self):
        Harness.setUp(self)

        self.alice = self.make_participant('alice', balance=10, claimed_time='now')
        self.bob = self.make_participant('bob', balance=10, claimed_time='now')
        self.carl = self.make_participant('carl', claimed_time='now')
        self.db.run("""
            INSERT INTO EXCHANGES
                (amount, fee, participant) VALUES
                (10.00, 0.00, 'alice'),
                (10.00, 0.00, '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')
示例#17
0
 def make_participant(self, username, *arg, **kw):
     participant = Harness.make_participant(self, username)
     if username == "alice":
         take_last_week = kw.get("take_last_week", "40")
         gittip.db.execute("INSERT INTO paydays DEFAULT VALUES")
         gittip.db.execute(
             "INSERT INTO transfers " "(timestamp, tipper, tippee, amount) " "VALUES (now(), 'Team', 'alice', %s)",
             (take_last_week,),
         )
     return participant
示例#18
0
 def make_participant(self, username, *arg, **kw):
     take_last_week = kw.pop('take_last_week', '40')
     participant = Harness.make_participant(self, username, **kw)
     if username == 'alice':
         gittip.db.run("INSERT INTO paydays DEFAULT VALUES")
         gittip.db.run(
             "INSERT INTO transfers "
             "(timestamp, tipper, tippee, amount) "
             "VALUES (now(), 'Team', 'alice', %s)", (take_last_week, ))
     return participant
示例#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.carl.set_tip_to(self.bob, '1.00')
        self.alice.set_tip_to(deadbeef, '1.00')
        self.bob.take_over(deadbeef_twitter, have_confirmation=True)
        self.deadbeef_archived = Participant.from_id(deadbeef.id)
示例#20
0
 def make_participant(self, username, *arg, **kw):
     take_last_week = kw.pop('take_last_week', '40')
     participant = Harness.make_participant(self, username, **kw)
     if username == 'alice':
         gittip.db.run("INSERT INTO paydays DEFAULT VALUES")
         gittip.db.run( "INSERT INTO transfers "
                        "(timestamp, tipper, tippee, amount) "
                        "VALUES (now(), 'Team', 'alice', %s)"
                      , (take_last_week,)
                       )
     return participant
示例#21
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) "
                      "VALUES (now(), %(tipper)s, %(tippee)s, %(amount)s)"
                    , dict(tipper=team_name, tippee=username, amount=take_last_week,)
                     )
     return participant
 def setUpClass(cls):
     Harness.setUpClass()
     cls.payday = Payday(mock.Mock())  # Mock out the DB connection
示例#23
0
 def make_participant(self, *a, **kw):
     kw['claimed_time'] = utcnow()
     return Harness.make_participant(self, *a, **kw)
示例#24
0
 def make_participant(self, *a, **kw):
     kw['claimed_time'] = datetime.datetime.now(pytz.utc)
     return Harness.make_participant(self, *a, **kw)
示例#25
0
 def tearDown(self):
     Harness.tearDown(self)
     os.environ['CANONICAL_SCHEME'] = self._blech[0]
     os.environ['CANONICAL_HOST'] = self._blech[1]
     wireup.canonical()
示例#26
0
 def setUp(self):
     Harness.setUp(self)
     self.bar = self.make_participant('bar', is_admin=True)
示例#27
0
 def setUp(self):
     Harness.setUp(self)
     self.make_participant('alice')
 def tearDown(self):
     Harness.tearDown(self)
     reset = Environment(CANONICAL_SCHEME=unicode, CANONICAL_HOST=unicode, environ=self.environ)
     wireup.canonical(reset)
示例#29
0
 def tearDown(self):
     Harness.tearDown(self)
     self.website.oauth_cache = {}
示例#30
0
 def setUp(self):
     Harness.setUp(self)
     for participant in ['alice', 'bob']:
         self.make_participant(participant, last_bill_result='')
示例#31
0
 def setUp(self):
     Harness.setUp(self)
     simplate = self.client.load_resource(b'/about/stats.html')
     self.commaize = simplate.pages[0]['commaize']
示例#32
0
 def setUp(self):
     Harness.setUp(self)
     now = utcnow()
     for username in ["alice", "bob", "carl"]:
         self.make_participant(username, claimed_time=now, elsewhere="twitter")
示例#33
0
 def tearDown(self):
     Harness.tearDown(self)
     self.website.oauth_cache = {}
示例#34
0
 def tearDown(self):
     Harness.tearDown(self)
     reset = Environment(CANONICAL_SCHEME=unicode,
                         CANONICAL_HOST=unicode,
                         environ=self.environ)
     wireup.canonical(reset)
示例#35
0
 def setUp(self):
     Harness.setUp(self)
     self.website = _test_website
     self.client = TestClient()
 def setUpClass(cls):
     Harness.setUpClass()
     cls.payday = Payday(mock.Mock())  # Mock out the DB connection
 def setUp(self):
     Harness.setUp(self)
     self.participant = self.make_participant('user1')  # Our protagonist
 def setUp(self):
     Harness.setUp(self)
     self.payday = Payday(self.db)
 def make_participant(self, *a, **kw):
     kw['claimed_time'] = datetime.datetime.now(pytz.utc)
     return Harness.make_participant(self, *a, **kw)
示例#40
0
 def tearDown(self):
     Harness.tearDown(self)
     os.environ['CANONICAL_SCHEME'] = self._blech[0]
     os.environ['CANONICAL_HOST'] = self._blech[1]
     wireup.canonical()
示例#41
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')
 def setUp(self):
     Harness.setUp(self)
     self.payday = Payday(self.db)
 def setUp(self):
     Harness.setUp(self)
     self.participant = self.make_participant('user1')  # Our protagonist
示例#44
0
 def setUp(self):
     Harness.setUp(self)
     simplate = self.client.load_resource(b'/about/stats.html')
     self.commaize = simplate.pages[0]['commaize']
 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)
 def setUp(self):
     Harness.setUp(self)
     self.make_participant("team", claimed_time=utcnow(), number='plural')
     self.make_participant("alice", claimed_time=utcnow())
示例#47
0
 def setUp(self):
     Harness.setUp(self)
     for participant in ['alice', 'bob']:
         p = self.make_participant(participant, last_bill_result='')
         setattr(self, participant, p)
 def setUp(self):
     Harness.setUp(self)
     now = utcnow()
     for username in ['alice', 'bob', 'carl']:
         self.make_participant(username, claimed_time=now, elsewhere='twitter')
示例#49
0
 def setUp(self):
     Harness.setUp(self)
     self.website = _test_website
     self.client = TestClient()
示例#50
0
 def setUp(self):
     Harness.setUp(self)
     self.team = self.make_participant('A-Team', number='plural')
 def make_participant(self, *a, **kw):
     kw['claimed_time'] = utcnow()
     return Harness.make_participant(self, *a, **kw)