示例#1
0
class BaseServerFixture(unittest.TestCase):

    """ Base class for tests that require a server object. """

    def setUp(self):
        self.server = RounderNetworkServer()
        self.table_name = "Test Table 1"
        self.table = self.server.create_table(self.table_name)

        self.user1 = TestUser("Test Player 1", self.server)
        self.user2 = TestUser("Test Player 2", self.server)
        self.user1.perspective_open_table(self.table.id)
        self.user2.perspective_open_table(self.table.id)
        self.user1_table = self.user1.table_views[self.table.id]
        self.user2_table = self.user1.table_views[self.table.id]

        self.users = [self.user1, self.user2]

    def clear_player_events(self):
        """
        Clears the stored events for each player. Used in a test
        immediately before doing something we expect to trigger events.
        """
        for user in self.users:
            user.events = []
示例#2
0
    def setUp(self):
        self.server = RounderNetworkServer()
        self.table_name = "Test Table 1"
        self.table = self.server.create_table(self.table_name)

        self.user1 = TestUser("Test Player 1", self.server)
        self.user2 = TestUser("Test Player 2", self.server)
        self.user1.perspective_open_table(self.table.id)
        self.user2.perspective_open_table(self.table.id)
        self.user1_table = self.user1.table_views[self.table.id]
        self.user2_table = self.user1.table_views[self.table.id]

        self.users = [self.user1, self.user2]