Exemplo n.º 1
0
 def test_tip(self):
     """Test the dashboard Tip model."""
     tip = Tip(
         emails=['*****@*****.**'],
         tokenName='ETH',
         amount=7,
         username='******',
         network='net',
         expires_date=date.today() + timedelta(days=1),
         tokenAddress='0x0000000000000000000000000000000000000000',
     )
     assert str(tip) == '(net) - PENDING 7 ETH to fred, created: today, expires: tomorrow'
     assert tip.get_natural_value() == 7e-18
     assert tip.value_in_eth == 7
     assert tip.value_in_usdt == 14
     assert tip.status == 'PENDING'
    def setUp(self):
        """Perform setup for the testcase."""
        assemble_leaderboards.ranks = default_ranks()
        tip = Tip(emails=['*****@*****.**'],
                  tokenName='USDT',
                  amount=7,
                  username='******',
                  network='net',
                  expires_date=date.today() + timedelta(days=1),
                  tokenAddress='0x0000000000000000000000000000000000000000')
        fulfiller_profile = Profile.objects.create(data={},
                                                   handle='fred',
                                                   email='*****@*****.**')
        bounty = Bounty.objects.create(
            title='foo',
            value_in_token=3,
            token_name='USDT',
            web3_created=datetime(2008, 10, 31),
            github_url='https://github.com/gitcoinco/web',
            token_address='0x0',
            issue_description='hello world',
            bounty_owner_github_username='******',
            is_open=False,
            accepted=True,
            expires_date=datetime(2008, 11, 30),
            idx_project_length=5,
            project_length='Months',
            bounty_type='Feature',
            experience_level='Intermediate',
            raw_data={},
            idx_status='submitted',
            current_bounty=True)
        BountyFulfillment.objects.create(
            fulfiller_address='0x0000000000000000000000000000000000000000',
            fulfiller_email='',
            fulfiller_github_username='******',
            fulfiller_name='Fred',
            bounty=bounty,
            profile=fulfiller_profile,
        )

        self.bounty = bounty
        self.tip = tip