コード例 #1
0
ファイル: friendBizApiTests.py プロジェクト: mozboz/friendbiz
    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']
コード例 #2
0
ファイル: friendBizApiTests.py プロジェクト: mozboz/friendbiz
    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])
コード例 #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'
コード例 #4
0
ファイル: friendBizApiTests.py プロジェクト: mozboz/friendbiz
    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
コード例 #5
0
ファイル: friendBizApiTests.py プロジェクト: mozboz/friendbiz
    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