예제 #1
0
 def setUp(self):
     super(BaseTestCase, self).setUp()
     self.anna = accounts.create('anna', status='active')
     _, wallet = models.Wallet.create_async(self.anna.key).get_result()
     self.anna_wallet_key = wallet.key
     self.bank = accounts.create('bank', status='active')
     self.bank_counter = 0
예제 #2
0
    def setUp(self):
        super(BaseTestCase, self).setUp()

        # Make sure the bots are initialized during this test.
        import roger.bots
        reload(roger.bots)

        # Set up a few accounts to use for testing.
        self.anna = accounts.create('anna', status='active')
        self.bob = accounts.create('bob', status='active')

        self.app = flask.Flask(__name__)
예제 #3
0
    def setUp(self):
        super(BaseTestCase, self).setUp()

        # Make sure the bots are initialized during this test.
        import roger.bots
        reload(roger.bots)

        # Create four test users.
        self.anna = accounts.create('anna', status='active')
        self.bob = accounts.create('bob')
        self.cecilia = accounts.create('cecilia')
        self.dennis = accounts.create('dennis')
예제 #4
0
 def test_adding_many_participants(self):
     stream = self.anna.streams.get_or_create([], title='BigGroup')
     for i in xrange(30):
         account = accounts.create(status='active')
         try:
             stream.invite(account.key)
         except db.BadRequestError:
             self.fail('adding participant #%d failed' % (i + 2, ))
     self.assertEqual(len(stream.participants), 31)
예제 #5
0
 def test_create_account_wallet(self):
     bob = accounts.create('bob', status='active')
     # Confirm that account doesn't have a wallet yet.
     self.assertIsNone(bob.wallet)
     # Create a wallet for the account.
     result = models.Wallet.create_async(bob.key).get_result()
     updated_bob, wallet = result
     self.assertEqual(updated_bob.wallet, wallet.key)
     self.assertEqual(wallet.account, bob.key)
     self.assertEqual(wallet.balance, 0)
예제 #6
0
    def test_receiving_change_status(self):
        cecilia = self.cecilia
        self.assertEqual(cecilia.account.status, 'active')
        self.dennis.streams.send(['cecilia'], 'dennis3.mp3', 1000)
        self.assertEqual(cecilia.account.status, 'active')

        elin = accounts.create('elin')
        self.assertEqual(elin.account.status, 'temporary')
        self.dennis.streams.send(['elin'], 'dennis4.mp3', 1000)
        elin.load()
        self.assertEqual(elin.account.status, 'invited')
예제 #7
0
    def setUp(self):
        super(BaseTestCase, self).setUp()

        # Set up a test client for the OAuth app.
        from roger.apps import oauth2
        self.client = oauth2.app.test_client()

        # Make sure the bots are initialized during this test.
        import roger.bots
        reload(roger.bots)

        client = models.ServiceClient(id='test_client',
                                      client_secret='test_secret',
                                      title='Test Client')
        client.put()

        # Set up an account to test logging in.
        self.anna = accounts.create('anna')
        self.anna.set_password('pa$$w0rd')
        self.ricardo = accounts.create('ricardo')
        with mock.patch('roger.files.gcs'):
            self.ricardo.set_greeting('test.mp3', 1234)