graphql-engine/server/testcases/defaults.json
2018-06-28 00:32:00 +05:30

163 lines
3.7 KiB
JSON

{
"description": "defaults test",
"depends": [],
"items": [
{
"name": "create_schema",
"url": "/api/1/query",
"role": "admin",
"status_code": 200,
"method": "POST",
"user_id": "1",
"sql_check": [
"SELECT 1 WHERE EXISTS(SELECT * from information_schema.columns where column_name='ts_sql' AND column_default='now()')"
],
"request": {
"kind": "create_table",
"body": {
"primary_key": [
"id"
],
"name": "a",
"columns": [
{
"type": "serial",
"name": "id"
},
{
"type": "timetz",
"name": "ts_sql",
"default": {
"__type": "expression",
"expression": "now()"
}
}
]
}
}
},
{
"name": "create_schema",
"url": "/api/1/query",
"role": "admin",
"status_code": 400,
"method": "POST",
"user_id": "1",
"response": {
"path": "$.columns",
"error": "Expecting ISO8601 formatted time"
},
"request": {
"kind": "create_table",
"body": {
"primary_key": [
"id"
],
"__type": "create_table",
"name": "b",
"columns": [
{
"type": "serial",
"name": "id"
},
{
"type": "timetz",
"name": "ts",
"default": {
"__type": "value",
"value": "now()"
}
}
]
}
}
},
{
"name": "create_schema",
"url": "/api/1/query",
"role": "admin",
"status_code": 400,
"method": "POST",
"user_id": "1",
"response": {
"path": "$.columns",
"error": "expected Int32, encountered String"
},
"request": {
"kind": "create_table",
"body": {
"primary_key": [
"id"
],
"__type": "create_table",
"name": "c",
"columns": [
{
"type": "serial",
"name": "id"
},
{
"type": "integer",
"name": "ts",
"default": "5"
}
]
}
}
},
{
"name": "create_schema",
"url": "/api/1/query",
"role": "admin",
"status_code": 200,
"method": "POST",
"user_id": "1",
"sql_check": [
"SELECT 1 WHERE EXISTS(SELECT * from information_schema.columns where column_name='ts' AND column_default :: integer=5)"
],
"request": {
"kind": "create_table",
"body": {
"primary_key": [
"id"
],
"__type": "create_table",
"name": "c",
"columns": [
{
"type": "serial",
"name": "id"
},
{
"type": "integer",
"name": "ts",
"default": 5
}
]
}
}
},
{
"name": "create_schema",
"url": "/api/1/query",
"role": "admin",
"status_code": 200,
"method": "POST",
"user_id": "1",
"sql_check": [
"SELECT 1 WHERE EXISTS(SELECT * from information_schema.columns where column_name='kk' AND column_default :: integer=100)"
],
"request": {
"kind": "add_column",
"body": {
"table": "c",
"column": {
"type": "integer",
"default": 100,
"name": "kk"
}
}
}
}
]
}