Esempio n. 1
0
	def test_update(self):
		"""
		Tests that the ruleset update method runs..
		"""
		ln = self.__class__.__name__
		r = Game(shortname=ln).ruleset
		r.update()
Esempio n. 2
0
	def test_turn(self):
		"""
		Test that the ruleset turn method runs..
		"""
		ln = self.__class__.__name__
		r = Game(shortname=ln).ruleset
		r.turn()
Esempio n. 3
0
	def test_player(self):
		"""
		Tests that the ruleset can add a player.
		"""
		ln = self.__class__.__name__
		r = Game(shortname=ln).ruleset
		r.player('testplayer1', 'password', 'email', 'comment')	
	def use(self, db=None):
		# Clear the old value
		old = self.game
		self.game = None

		if db != None:
			from tp.server.bases.Game import Game
			if isinstance(db, Game):
				self.game = db.id
			elif isinstance(db, (str, unicode)):
				self.game = Game.gameid(db)
			elif isinstance(db, int):
				self.game = db
			else:
				raise SyntaxError("dbconn.use called with a weird argument %s" % db)

		# Return the previous value...
		return old
Esempio n. 5
0
    def use(self, db=None):
        # Clear the old value
        old = self.game
        self.game = None

        if db != None:
            from tp.server.bases.Game import Game
            if isinstance(db, Game):
                self.game = db.id
            elif isinstance(db, (str, unicode)):
                self.game = Game.gameid(db)
            elif isinstance(db, int):
                self.game = db
            else:
                raise SyntaxError(
                    "dbconn.use called with a weird argument %s" % db)

        # Return the previous value...
        return old
Esempio n. 6
0
 def game_set(self, value):
     if hasattr(self, '__game'):
         raise TypeError('The game can not be changed!')
     self.__game = Game(id=value)
Esempio n. 7
0
	def setup_class(cls):
		# Okay create a new game then
		print 'Class name!', cls.__name__

		g = Game()
		g.ruleset  = ruleset
		g.shortname= cls.__name__
		g.longname = cls.__name__
		g.admin    = 'admin@localhost'
		g.comment  = 'A test game'
		g.turn     = 0
		g.commandline="Unknown!"
		g.save()

		g.ruleset.initialise()
Esempio n. 8
0
	def test_initialise(self):
		"""
		Tests that we can initialise a new game using the ruleset.
		"""
		# Okay create a new game then
		g = Game()
		g.ruleset  = ruleset
		g.shortname= self.__class__.__name__
		g.longname = gamename
		g.admin    = 'admin@localhost'
		g.comment  = 'A test game'
		g.turn     = 0
		g.commandline="Unknown!"
		g.save()

		g.ruleset.initialise()
Esempio n. 9
0
	def test_load(self):
		"""
		Tests that a ruleset can be successfully loaded.
		"""
		g = Game()
		g.ruleset  = ruleset