Exemplo n.º 1
0
	def build_resolution_message(self):
		"""
		Retrieve all notes addressed to the player for this turn, and build a message to remember them.
		"""
		self.add_note(content="Argent disponible pour le tour : %sk¥" % self.money)

		notes = Note.objects.filter(recipient_set=self, turn=self.game.current_turn)
		m = Message.build_message_from_notes(
			message_type=Message.RESOLUTION,
			notes=notes,
			title="Message de résolution du tour %s" % self.game.current_turn,
			turn=self.game.current_turn
		)
		m.recipient_set.add(self)
		return m
Exemplo n.º 2
0
	def test_message_building_content(self):
		"""
		Check content is built in right order
		"""

		Note.objects.create(
			content="global",
			turn=self.g.current_turn
		)
		Note.objects.create(
			category=Note.SPECULATION,
			content="speculation",
			turn=self.g.current_turn
		)
		Note.objects.create(
			category=Note.RUNS,
			content="runs",
			turn=self.g.current_turn
		)
		Note.objects.create(
			category=Note.DIVIDEND,
			content="dividend",
			turn=self.g.current_turn
		)

		opening = "Opening"
		m = Message.build_message_from_notes(
			message_type=Message.RESOLUTION,
			notes=Note.objects.all(),
			opening=opening,
			title="test",
			turn=self.g.current_turn
		)

		expected = u"""Opening

* global

### Runs
* runs

### Spéculations
* speculation

### Dividendes
* dividend"""

		self.assertEqual(m.content.strip(), expected)
Exemplo n.º 3
0
    def test_message_building_content(self):
        """
		Check content is built in right order
		"""

        Note.objects.create(content="global", turn=self.g.current_turn)
        Note.objects.create(category=Note.SPECULATION,
                            content="speculation",
                            turn=self.g.current_turn)
        Note.objects.create(category=Note.RUNS,
                            content="runs",
                            turn=self.g.current_turn)
        Note.objects.create(category=Note.DIVIDEND,
                            content="dividend",
                            turn=self.g.current_turn)

        opening = "Opening"
        m = Message.build_message_from_notes(message_type=Message.RESOLUTION,
                                             notes=Note.objects.all(),
                                             opening=opening,
                                             title="test",
                                             turn=self.g.current_turn)

        expected = u"""Opening

* global

### Runs
* runs

### Spéculations
* speculation

### Dividendes
* dividend"""

        self.assertEqual(m.content.strip(), expected)