Skip to content

Commit

Permalink
refactor test
Browse files Browse the repository at this point in the history
  • Loading branch information
Anish9901 committed Jun 10, 2024
1 parent 5945d65 commit 4234b01
Showing 1 changed file with 3 additions and 30 deletions.
33 changes: 3 additions & 30 deletions mathesar/tests/rpc/test_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,35 +147,8 @@ def mock_connect(_database_id, user):
def mock_table_add(_schema_oid, conn):
if _schema_oid != schema_oid:
raise AssertionError('incorrect parameters passed')
return [
{
'oid': 17408,
'name': 'Authors',
'schema': schema_oid,
'description': 'a description on the authors table.'
},
{
'oid': 17809,
'name': 'Books',
'schema': schema_oid,
'description': None
}
]
return 1964474
monkeypatch.setattr(tables, 'connect', mock_connect)
monkeypatch.setattr(tables, 'create_table_on_database', mock_table_add)
expect_table_list = [
{
'oid': 17408,
'name': 'Authors',
'schema': schema_oid,
'description': 'a description on the authors table.'
},
{
'oid': 17809,
'name': 'Books',
'schema': schema_oid,
'description': None
}
]
actual_table_list = tables.add(schema_oid=2200, database_id=11, request=request)
assert actual_table_list == expect_table_list
actual_table_oid = tables.add(table_name='newtable', schema_oid=2200, database_id=11, request=request)
assert actual_table_oid == 1964474

0 comments on commit 4234b01

Please sign in to comment.