Ejemplo n.º 1
0
    def test_load_table(self, mock_load_csv):
        """Test load table"""
        # Setup
        metadata = Mock(spec=Metadata)
        metadata.root_path = 'a/path'
        metadata.get_table_meta.return_value = {'some': 'data'}
        mock_load_csv.return_value = 'data'

        # Run
        result = Metadata.load_table(metadata, 'test')

        # Asserts
        assert result == 'data'

        metadata.get_table_meta.assert_called_once_with('test')
        mock_load_csv.assert_called_once_with('a/path', {'some': 'data'})
Ejemplo n.º 2
0
    def test_load_table(self, mock_load_csv):
        """Test load table"""
        # Setup
        root_path = '.'
        table_meta = {'some': 'data'}

        # Run
        metadata = Mock()
        metadata.root_path = root_path
        metadata.get_table_meta.return_value = table_meta
        mock_load_csv.return_value = 'data'

        table_name = 'test'

        result = Metadata.load_table(metadata, table_name)

        # Asserts
        metadata.get_table_meta.assert_called_once_with('test')
        mock_load_csv.assert_called_once_with('.', {'some': 'data'})
        assert result == 'data'