def test_slash_dE(executor):

    with foreign_db_environ():
        results = executor(r"\dE")
        title = None
        rows = [("public", "foreign_foo", "foreign table", "postgres")]
        headers = ["Schema", "Name", "Type", "Owner"]
        status = "SELECT 1"
        expected = [title, rows, headers, status]
        assert results == expected
Example #2
0
def test_slash_dE_verbose(executor):

    with foreign_db_environ():
        results = executor('\dE+')
        title = None
        rows = [('public', 'foreign_foo', 'foreign table', 'postgres', '0 bytes', None)]
        headers = ['Schema', 'Name', 'Type', 'Owner', 'Size', 'Description']
        status = 'SELECT 1'
        expected = [title, rows, headers, status]
        assert results == expected
Example #3
0
def test_slash_dE(executor):

    with foreign_db_environ():
        results = executor('\dE')
        title = None
        rows = [('public', 'foreign_foo', 'foreign table', 'postgres')]
        headers =  ['Schema', 'Name', 'Type', 'Owner']
        status = 'SELECT 1'
        expected = [title, rows, headers, status]
        assert results == expected
Example #4
0
def test_slash_dE_verbose(executor):

    with foreign_db_environ():
        results = executor(r"\dE+")
        title = None
        rows = [("public", "foreign_foo", "foreign table", "postgres", "0 bytes", None)]
        headers = ["Schema", "Name", "Type", "Owner", "Size", "Description"]
        status = "SELECT 1"
        expected = [title, rows, headers, status]
        assert results == expected
Example #5
0
def test_slash_dE_with_pattern(executor):

    with foreign_db_environ():
        results = executor("\dE foreign_foo")
        title = None
        rows = [("public", "foreign_foo", "foreign table", "postgres")]
        headers = ["Schema", "Name", "Type", "Owner"]
        status = "SELECT 1"
        expected = [title, rows, headers, status]
        assert results == expected

        results = executor("\dE *_foo")
        assert results == expected

        results = executor("\dE no_such_table")
        rows = []
        status = "SELECT 0"
        expected = [title, rows, headers, status]
        assert results == expected