Example #1
0
    def test_check_content_definitions_nothing_old(self, mock_type_definition, mock_parser):
        """
        Test that when the content type from the database matches the TypeDefinition,
        an empty list is returned.
        """
        fake_type = {
            'id': 'steve_holt',
            'display_name': 'STEVE HOLT!',
            'description': 'STEVE HOLT!',
            'unit_key': ['STEVE HOLT!'],
            'search_indexes': ['STEVE HOLT!'],
            'referenced_types': ['STEVE HOLT!'],
        }
        mock_type_definition.return_value = fake_type
        type_definition = TypeDefinition('steve_holt', 'STEVE HOLT!', 'STEVE HOLT!', 'STEVE HOLT!',
                                         'STEVE HOLT!', 'STEVE HOLT!')

        result = api._check_content_definitions([type_definition])
        self.assertEquals(0, len(result))
Example #2
0
    def test_check_content_definitions_old(self, mock_type_definition):
        """
        Test that when the content type from the database doesn't match the TypeDefinition,
        the list contains that content type.
        """
        fake_type = {
            'id': 'gob',
            'display_name': 'Trickster',
            'description': 'Trickster',
            'unit_key': ['Trickster'],
            'search_indexes': ['Trickster'],
            'referenced_types': ['Trickster'],
        }
        mock_type_definition.return_value = fake_type
        type_definition = TypeDefinition('gob', 'STEVE HOLT!', 'STEVE HOLT!', 'STEVE HOLT!',
                                         'STEVE HOLT!', 'STEVE HOLT!')

        result = api._check_content_definitions([type_definition])
        self.assertEquals(1, len(result))
        self.assertEquals(result[0], type_definition)