Skip to content

Commit

Permalink
add test cases of test_show in http_test (infiniflow#1659)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

_Briefly describe what this PR aims to solve. Include background context
that will help reviewers understand the purpose of the PR._

### Type of change


- [x] Test cases
  • Loading branch information
zjbpaul1317 authored Aug 15, 2024
1 parent e680dba commit c7d932d
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions python/test_http_api/test_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,59 @@ def test_http_show_columns(self):

self.drop_table(db_name, table_name)
return

def test_http_show_table_after_insert(self):
db_name = "default_db"
table_name = "test_http_show_table_fater_insert"

self.drop_table(db_name, table_name)

self.create_table(
db_name, table_name, [
{
"name": "num",
"type": "integer",
},
{
"name": "body",
"type": "varchar",
},
{
"name": "vec",
"type": "vector",
"dimension": 5,
"element_type": "float",
}
]
)

self.insert_data(
db_name, table_name, [
{"num": 1, "body": "test", "vec": [0.1, 0.2, 0.3, 0.4, 0.5]},
{"num": 2, "body": "sample", "vec": [0.2, 0.3, 0.4, 0.5, 0.6]}
]
)

self.show_table(db_name, table_name, {
"error_code": 0,
"database_name": db_name,
"table_name": table_name,
"column_count": 3,
"row_count": 2
})

self.drop_table(db_name, table_name)
return

def test_http_show_nonexistent_table(self):
db_name = "default_db"
table_name = "nonexistent_table"

self.show_table(db_name, table_name, {
"status_code": 404,
"error_code": 1004,
"message": f"Table {table_name} do not exist in database {db_name}."
})
return


0 comments on commit c7d932d

Please sign in to comment.