mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-09-20 15:09:02 +03:00
server: Add test file to suite
GitOrigin-RevId: 6522f776c9b267d5c94be484d55f879e79d30c96
This commit is contained in:
parent
12b57530f3
commit
5ad01a4bac
@ -7,47 +7,35 @@
|
||||
query:
|
||||
type: create_object_relationship
|
||||
args:
|
||||
table: article
|
||||
name: author
|
||||
table: author
|
||||
name: details
|
||||
using:
|
||||
foreign_key_constraint_on:
|
||||
table: author
|
||||
table: author_details
|
||||
column: author_id
|
||||
|
||||
- description: Nested select on article
|
||||
- description: Nested select
|
||||
url: /v1/query
|
||||
status: 200
|
||||
response:
|
||||
- id: 1
|
||||
title: Article 1
|
||||
content: Sample article content 1
|
||||
author:
|
||||
id: 1
|
||||
name: Author 1
|
||||
name: Author 1
|
||||
details:
|
||||
email: "author1@authors.com"
|
||||
- id: 2
|
||||
title: Article 2
|
||||
content: Sample article content 2
|
||||
author:
|
||||
id: 1
|
||||
name: Author 1
|
||||
- id: 3
|
||||
title: Article 3
|
||||
content: Sample article content 3
|
||||
author:
|
||||
id: 2
|
||||
name: Author 2
|
||||
name: Author 2
|
||||
details:
|
||||
email: "author2@authors.com"
|
||||
query:
|
||||
type: select
|
||||
args:
|
||||
table: article
|
||||
table: author
|
||||
columns:
|
||||
- id
|
||||
- title
|
||||
- content
|
||||
- name: author
|
||||
- name
|
||||
- name: details
|
||||
columns:
|
||||
- id
|
||||
- name
|
||||
- email
|
||||
|
||||
- description: Drop object relationship
|
||||
url: /v1/query
|
||||
@ -57,5 +45,5 @@
|
||||
query:
|
||||
type: drop_relationship
|
||||
args:
|
||||
table: article
|
||||
relationship: author
|
||||
table: author
|
||||
relationship: details
|
||||
|
@ -11,6 +11,11 @@ args:
|
||||
name text unique,
|
||||
remarks text
|
||||
);
|
||||
create table author_details(
|
||||
id serial primary key,
|
||||
author_id INTEGER REFERENCES author(id),
|
||||
email text unique
|
||||
);
|
||||
CREATE VIEW author_view AS
|
||||
SELECT id, UPPER(name) as name FROM author;
|
||||
CREATE TABLE article (
|
||||
@ -45,6 +50,11 @@ args:
|
||||
schema: public
|
||||
name: author
|
||||
|
||||
- type: track_table
|
||||
args:
|
||||
schema: public
|
||||
name: author_details
|
||||
|
||||
#View author_view
|
||||
- type: track_table
|
||||
args:
|
||||
@ -95,6 +105,15 @@ args:
|
||||
- name: Author 1
|
||||
- name: Author 2
|
||||
|
||||
- type: insert
|
||||
args:
|
||||
table: author_details
|
||||
objects:
|
||||
- author_id: 1
|
||||
email: "author1@authors.com"
|
||||
- author_id: 2
|
||||
email: "author2@authors.com"
|
||||
|
||||
#Insert Article table data
|
||||
- type: insert
|
||||
args:
|
||||
|
@ -1,12 +1,12 @@
|
||||
type: bulk
|
||||
args:
|
||||
|
||||
- type: run_sql
|
||||
args:
|
||||
sql: |
|
||||
DROP VIEW article_view;
|
||||
DROP TABLE article;
|
||||
DROP VIEW author_view;
|
||||
DROP TABLE author_details;
|
||||
DROP TABLE author;
|
||||
DROP VIEW hge_tests.address_view;
|
||||
DROP TABLE hge_tests.address;
|
||||
|
@ -570,6 +570,9 @@ class TestRelationships:
|
||||
def test_array_relationship_manual(self, hge_ctx):
|
||||
check_query_f(hge_ctx, self.dir() + '/array_relationship_manual.yaml')
|
||||
|
||||
def test_object_relationship_one_to_one(self, hge_ctx):
|
||||
check_query_f(hge_ctx, self.dir() + '/object_relationship_one_to_one.yaml')
|
||||
|
||||
@classmethod
|
||||
def dir(cls):
|
||||
return "queries/v1/relationships"
|
||||
|
Loading…
Reference in New Issue
Block a user