Ejemplo n.º 1
0
    def testHistory(self):
        u1, u2, u3, t1 = setupUsersAndTransactions(self.session, self.config)
        for x in range(0,20):
            self.friendBizAPI.buy(u1.handle, u3.handle)
            self.friendBizAPI.buy(u2.handle, u3.handle)

        assert len(self.friendBizAPI.getHistory(u1.handle)) == self.config['historyLength']
Ejemplo n.º 2
0
    def testInventory(self):
        # setup data
        u1, u2, u3, t1 = setupUsersAndTransactions(self.session, self.config)

        # check inventory returns correct users
        # u1 should have two users in inventory: u2, u3
        inventory = self.friendBizAPI.getInventory(u1.id, self.session)
        assert len(inventory) == 2
        assert sorted([u.id for u in inventory]) == sorted([u3.id, u2.id])
Ejemplo n.º 3
0
 def testStatusCommand(self):
     u1, u2, u3, t1 = setupUsersAndTransactions(self.session, self.config)
     h = "someguy"
     self.command._dispatch("status", [u1.handle], h)
     assert self.fakeTwitter.updateStatusCalls[0] == '@' + h +', @' + u1.handle + ' is not owned. Their price is 1, they have 100 credits and own 2 players'
     self.command._dispatch("status", [u2.handle], h)
     assert self.fakeTwitter.updateStatusCalls[1] == '@' + h +', @' + u2.handle + ' is owned by @' + u1.handle + '. Their price is 1, they have 100 credits and own 0 players'
     self.command._dispatch("status", [u3.handle], h)
     assert self.fakeTwitter.updateStatusCalls[2] == '@' + h +', @' + u3.handle + ' is owned by @' + u1.handle + '. Their price is 1, they have 100 credits and own 0 players'
     # test with extra @ on front, output should be same
     self.command._dispatch("status", ['@' + u3.handle], h)
     assert self.fakeTwitter.updateStatusCalls[3] == '@' + h +', @' + u3.handle + ' is owned by @' + u1.handle + '. Their price is 1, they have 100 credits and own 0 players'
Ejemplo n.º 4
0
    def testOwner(self):
        u1, u2, u3, t1 = setupUsersAndTransactions(self.session, self.config)

        # u2 should be owned by u1
        assert self.friendBizAPI.getOwnerID(u2.id, self.session) == u1.id
Ejemplo n.º 5
0
    def testTransactions(self):
        u1, u2, u3, t1 = setupUsersAndTransactions(self.session, self.config)

        assert len(u1.transactions.all()) == 2
        assert u1.transactions[0].id == t1.id
        assert u2.transactions[0].id == t1.id