Beispiel #1
0
    def test_all_decks_as_dict(self):
        """Tests the get_all_decks_as_dict() classmethod of the Deck model."""
        # Get the dict containing all decks
        decks_dict = Deck.get_all_decks_as_dict()

        # Check if the dict is correct
        # Note: The order is important because of the way the models get ordered defined in the Meta class of Deck
        self.assertDictEqual(
            decks_dict, {
                "decks": [{
                    "id": 2,
                    "name": "Second",
                    "official": True
                }, {
                    "id": 1,
                    "name": "First",
                    "official": False
                }]
            }, "get_all_decks_as_dict() doesn't give the right result!")