Ejemplo n.º 1
0
    def test_get_concrete_type_of_worksheet_invalid_format(self):
        # given:
        schema_template = MagicMock(name='schema_template')
        manager = TemplateManager(schema_template,
                                  MagicMock(name='ingest_api'))

        # when:
        raised_exception = None
        try:
            manager.get_concrete_type('- does not match format -')
        except InvalidTabName as exception:
            raised_exception = exception

        # then:
        self.assertIsNotNone(raised_exception)
        self.assertEqual('- does not match format -',
                         raised_exception.tab_name)
Ejemplo n.º 2
0
    def test_get_concrete_type_of_regular_worksheet(self):
        # given
        schema_template = MagicMock(name='schema_template')
        schema_template.get_tab_key = MagicMock(return_value='user_profile')
        manager = TemplateManager(schema_template,
                                  MagicMock(name='ingest_api'))

        # expect:
        self.assertEqual('user_profile',
                         manager.get_concrete_type('User Profile'))
        schema_template.get_tab_key.assert_called_with('User Profile')
Ejemplo n.º 3
0
    def test_get_concrete_type_of_module_worksheet(self):
        # given:
        schema_template = MagicMock(name='schema_template')
        schema_template.get_tab_key = MagicMock(return_value='product')
        manager = TemplateManager(schema_template,
                                  MagicMock(name='ingest_api'))

        # expect:
        self.assertEqual('product',
                         manager.get_concrete_type('Product - Barcodes'))

        # and:
        schema_template.get_tab_key.assert_called_with('Product')
Ejemplo n.º 4
0
    def test_get_concrete_type_of_regular_worksheet(self):
        # given
        schema_template = MagicMock(name='schema_template')
        schema_template.lookup_metadata_schema_name_given_title = MagicMock(
            return_value='user_profile')
        manager = TemplateManager(schema_template,
                                  MagicMock(name='mock_ingest_api'))

        # expect:
        self.assertEqual('user_profile',
                         manager.get_concrete_type('User Profile'))
        schema_template.lookup_metadata_schema_name_given_title.assert_called_with(
            'User Profile')