Skip to content
This repository was archived by the owner on Feb 21, 2022. It is now read-only.

Commit e3c8f58

Browse files
author
Jaroslav Sevcik
committed
chore(entity): graphql api update
1 parent 15e7d1a commit e3c8f58

File tree

13 files changed

+566
-62
lines changed

13 files changed

+566
-62
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# -*- coding: utf-8 -*-
2+
# snapshottest: v1 - https://goo.gl/zC4yUc
3+
from __future__ import unicode_literals
4+
5+
from snapshottest import Snapshot
6+
7+
8+
snapshots = Snapshot()
9+
10+
snapshots['test_all 1'] = {
11+
'data': {
12+
'allEntities': None
13+
},
14+
'errors': [
15+
{
16+
'locations': [
17+
{
18+
'column': 7,
19+
'line': 3
20+
}
21+
],
22+
'message': 'Resolved value from the connection field have to be iterable or instance of EntityConnection. Received "None"',
23+
'path': [
24+
'allEntities'
25+
]
26+
}
27+
]
28+
}
29+
30+
snapshots['test_empty 1'] = {
31+
'errors': [
32+
{
33+
'locations': [
34+
{
35+
'column': 7,
36+
'line': 3
37+
}
38+
],
39+
'message': 'Cannot query field "allEntities" on type "Query". Did you mean "allEntities", "allServices", "allLibraries" or "allRepositories"?'
40+
}
41+
]
42+
}
43+
44+
snapshots['test_first 1'] = {
45+
'data': {
46+
'allEntities': None
47+
},
48+
'errors': [
49+
{
50+
'locations': [
51+
{
52+
'column': 7,
53+
'line': 3
54+
}
55+
],
56+
'message': 'Resolved value from the connection field have to be iterable or instance of EntityConnection. Received "None"',
57+
'path': [
58+
'allEntities'
59+
]
60+
}
61+
]
62+
}
63+
64+
snapshots['test_last 1'] = {
65+
'errors': [
66+
{
67+
'locations': [
68+
{
69+
'column': 13,
70+
'line': 7
71+
}
72+
],
73+
'message': 'Cannot query field "allEnvironments" on type "Entity".'
74+
}
75+
]
76+
}
Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,32 @@
44

55

66
@pytest.fixture
7-
def generate_links(service_factory, link_factory):
8-
service = service_factory(
7+
def generate_links(link_factory, component_base_factory):
8+
component = component_base_factory(
99
id=1,
10-
name="martinez",
11-
owner="michaelbennett",
12-
impact="profit",
13-
docs_url="https://docsurl",
14-
pagerduty_service="sales/P019873X9",
15-
slack_channel="https://slackchannel",
16-
status="fixed",
10+
name="base",
11+
type="database",
12+
description="This is my fancy component",
13+
kind="component",
14+
owner="platform",
15+
service=None,
16+
library=None,
17+
source__id=1,
18+
source__remote_id=1,
19+
source__owner="jasckson",
20+
source__name="thiwer",
21+
source__url="https://gitlab.com/thiwer/thiwer",
1722
)
1823
link_factory(
1924
id=1,
20-
content_object=service,
25+
entity=component,
2126
name="Datadog",
2227
url="https://datadog.com",
2328
icon="datadog",
2429
)
2530
link_factory(
2631
id=2,
27-
content_object=service,
32+
entity=component,
2833
name="Sentry",
2934
url="https://sentry.com",
3035
icon="sentry",
@@ -34,7 +39,7 @@ def generate_links(service_factory, link_factory):
3439
def test_empty(snapshot, call_api):
3540
query = """
3641
query {
37-
allServices {
42+
allEntities {
3843
totalCount
3944
edges {
4045
node {
@@ -58,7 +63,7 @@ def test_empty(snapshot, call_api):
5863
def test_all(snapshot, call_api, generate_links):
5964
query = """
6065
query {
61-
allServices {
66+
allEntities {
6267
totalCount
6368
edges {
6469
node {
@@ -91,7 +96,7 @@ def test_all(snapshot, call_api, generate_links):
9196
def test_first(snapshot, call_api, generate_links):
9297
query = """
9398
query {
94-
allServices {
99+
allEntities {
95100
totalCount
96101
edges {
97102
node {
@@ -124,7 +129,7 @@ def test_first(snapshot, call_api, generate_links):
124129
def test_last(snapshot, call_api, generate_links):
125130
query = """
126131
query {
127-
allServices {
132+
allEntities {
128133
totalCount
129134
edges {
130135
node {

test/api/query/test_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def test_service(snapshot, call_api, service_factory):
99
id=10,
1010
owner="bradltwat",
1111
name="allen-nobles",
12-
status="fixed",
12+
lifecycle="fixed",
1313
impact="sales",
1414
slack_channel="https://gitlab.slack",
1515
pagerduty_service="sales/P019873X9",

test/api/query/test_service_environments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def generate_environments(service_factory, environment_factory):
1616
docs_url="https://docsurl",
1717
pagerduty_service="sales/P019873X9",
1818
slack_channel="https://slackchannel",
19-
status="fixed",
19+
lifecycle="fixed",
2020
)
2121
environment_factory(
2222
id=1,

test/api/query/test_services.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def generate_services(service_factory):
1616
docs_url="https://docsurl",
1717
pagerduty_service="/services",
1818
slack_channel="https://slackchannel",
19-
status="fixed",
19+
lifecycle="fixed",
2020
repository__id=78,
2121
repository__remote_id=239,
2222
repository__owner="jasckson",
@@ -31,7 +31,7 @@ def generate_services(service_factory):
3131
docs_url="https://docsurl",
3232
pagerduty_service="/services",
3333
slack_channel="https://slackchannel",
34-
status="fixed",
34+
lifecycle="fixed",
3535
repository__id=48,
3636
repository__remote_id=99,
3737
repository__owner="colisn",
@@ -46,7 +46,7 @@ def generate_services(service_factory):
4646
docs_url="https://docsurl",
4747
pagerduty_service="/services",
4848
slack_channel="https://slackchannel",
49-
status="fixed",
49+
lifecycle="fixed",
5050
repository__id=234,
5151
repository__remote_id=9234,
5252
repository__owner="Daniel",
@@ -61,7 +61,7 @@ def generate_services(service_factory):
6161
docs_url="https://docsurl",
6262
pagerduty_service="/services",
6363
slack_channel="https://slackchannel",
64-
status="fixed",
64+
lifecycle="fixed",
6565
repository__id=3434,
6666
repository__remote_id=349,
6767
repository__owner="josh",
@@ -77,7 +77,7 @@ def generate_services(service_factory):
7777
docs_url="https://docsurl",
7878
pagerduty_service="/services",
7979
slack_channel="https://slackchannel",
80-
status="fixed",
80+
lifecycle="fixed",
8181
repository__id=4543,
8282
repository__remote_id=990,
8383
repository__owner="imosley",
@@ -96,7 +96,7 @@ def generate_services_with_environments(service_factory, environment_factory):
9696
docs_url="https://docsurl",
9797
pagerduty_service="/services",
9898
slack_channel="https://slackchannel",
99-
status="fixed",
99+
lifecycle="fixed",
100100
repository__id=78,
101101
repository__remote_id=239,
102102
repository__owner="jasckson",
@@ -131,7 +131,7 @@ def generate_services_with_links(service_factory, link_factory):
131131
docs_url="https://docsurl",
132132
pagerduty_service="/services",
133133
slack_channel="https://slackchannel",
134-
status="fixed",
134+
lifecycle="fixed",
135135
repository__id=78,
136136
repository__remote_id=239,
137137
repository__owner="jasckson",

test/entities/test_objects_to_yaml.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
@pytest.fixture
1212
def generate_base_component(component_base_factory, link_factory, group_factory):
13-
group = group_factory(id=1, product_owner="john", project_owner="doe")
14-
group.save()
1513
component = component_base_factory(
1614
id=1,
1715
name="base",
@@ -26,9 +24,12 @@ def generate_base_component(component_base_factory, link_factory, group_factory)
2624
source__owner="jasckson",
2725
source__name="thiwer",
2826
source__url="https://gitlab.com/thiwer/thiwer",
29-
group=group,
3027
)
3128
component.save()
29+
30+
group = group_factory(id=1, product_owner="john", project_owner="doe", entity=component)
31+
group.save()
32+
3233
link_factory(
3334
id=1,
3435
name="Datadog",

0 commit comments

Comments
 (0)