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

Commit

Permalink
chore(entity): graphql api update
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaroslav Sevcik committed Jul 13, 2021
1 parent 15e7d1a commit e3c8f58
Show file tree
Hide file tree
Showing 13 changed files with 566 additions and 62 deletions.
76 changes: 76 additions & 0 deletions test/api/query/snapshots/snap_test_entity_links.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# -*- coding: utf-8 -*-
# snapshottest: v1 - https://goo.gl/zC4yUc
from __future__ import unicode_literals

from snapshottest import Snapshot


snapshots = Snapshot()

snapshots['test_all 1'] = {
'data': {
'allEntities': None
},
'errors': [
{
'locations': [
{
'column': 7,
'line': 3
}
],
'message': 'Resolved value from the connection field have to be iterable or instance of EntityConnection. Received "None"',
'path': [
'allEntities'
]
}
]
}

snapshots['test_empty 1'] = {
'errors': [
{
'locations': [
{
'column': 7,
'line': 3
}
],
'message': 'Cannot query field "allEntities" on type "Query". Did you mean "allEntities", "allServices", "allLibraries" or "allRepositories"?'
}
]
}

snapshots['test_first 1'] = {
'data': {
'allEntities': None
},
'errors': [
{
'locations': [
{
'column': 7,
'line': 3
}
],
'message': 'Resolved value from the connection field have to be iterable or instance of EntityConnection. Received "None"',
'path': [
'allEntities'
]
}
]
}

snapshots['test_last 1'] = {
'errors': [
{
'locations': [
{
'column': 13,
'line': 7
}
],
'message': 'Cannot query field "allEnvironments" on type "Entity".'
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,32 @@


@pytest.fixture
def generate_links(service_factory, link_factory):
service = service_factory(
def generate_links(link_factory, component_base_factory):
component = component_base_factory(
id=1,
name="martinez",
owner="michaelbennett",
impact="profit",
docs_url="https://docsurl",
pagerduty_service="sales/P019873X9",
slack_channel="https://slackchannel",
status="fixed",
name="base",
type="database",
description="This is my fancy component",
kind="component",
owner="platform",
service=None,
library=None,
source__id=1,
source__remote_id=1,
source__owner="jasckson",
source__name="thiwer",
source__url="https://gitlab.com/thiwer/thiwer",
)
link_factory(
id=1,
content_object=service,
entity=component,
name="Datadog",
url="https://datadog.com",
icon="datadog",
)
link_factory(
id=2,
content_object=service,
entity=component,
name="Sentry",
url="https://sentry.com",
icon="sentry",
Expand All @@ -34,7 +39,7 @@ def generate_links(service_factory, link_factory):
def test_empty(snapshot, call_api):
query = """
query {
allServices {
allEntities {
totalCount
edges {
node {
Expand All @@ -58,7 +63,7 @@ def test_empty(snapshot, call_api):
def test_all(snapshot, call_api, generate_links):
query = """
query {
allServices {
allEntities {
totalCount
edges {
node {
Expand Down Expand Up @@ -91,7 +96,7 @@ def test_all(snapshot, call_api, generate_links):
def test_first(snapshot, call_api, generate_links):
query = """
query {
allServices {
allEntities {
totalCount
edges {
node {
Expand Down Expand Up @@ -124,7 +129,7 @@ def test_first(snapshot, call_api, generate_links):
def test_last(snapshot, call_api, generate_links):
query = """
query {
allServices {
allEntities {
totalCount
edges {
node {
Expand Down
2 changes: 1 addition & 1 deletion test/api/query/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def test_service(snapshot, call_api, service_factory):
id=10,
owner="bradltwat",
name="allen-nobles",
status="fixed",
lifecycle="fixed",
impact="sales",
slack_channel="https://gitlab.slack",
pagerduty_service="sales/P019873X9",
Expand Down
2 changes: 1 addition & 1 deletion test/api/query/test_service_environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def generate_environments(service_factory, environment_factory):
docs_url="https://docsurl",
pagerduty_service="sales/P019873X9",
slack_channel="https://slackchannel",
status="fixed",
lifecycle="fixed",
)
environment_factory(
id=1,
Expand Down
14 changes: 7 additions & 7 deletions test/api/query/test_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def generate_services(service_factory):
docs_url="https://docsurl",
pagerduty_service="/services",
slack_channel="https://slackchannel",
status="fixed",
lifecycle="fixed",
repository__id=78,
repository__remote_id=239,
repository__owner="jasckson",
Expand All @@ -31,7 +31,7 @@ def generate_services(service_factory):
docs_url="https://docsurl",
pagerduty_service="/services",
slack_channel="https://slackchannel",
status="fixed",
lifecycle="fixed",
repository__id=48,
repository__remote_id=99,
repository__owner="colisn",
Expand All @@ -46,7 +46,7 @@ def generate_services(service_factory):
docs_url="https://docsurl",
pagerduty_service="/services",
slack_channel="https://slackchannel",
status="fixed",
lifecycle="fixed",
repository__id=234,
repository__remote_id=9234,
repository__owner="Daniel",
Expand All @@ -61,7 +61,7 @@ def generate_services(service_factory):
docs_url="https://docsurl",
pagerduty_service="/services",
slack_channel="https://slackchannel",
status="fixed",
lifecycle="fixed",
repository__id=3434,
repository__remote_id=349,
repository__owner="josh",
Expand All @@ -77,7 +77,7 @@ def generate_services(service_factory):
docs_url="https://docsurl",
pagerduty_service="/services",
slack_channel="https://slackchannel",
status="fixed",
lifecycle="fixed",
repository__id=4543,
repository__remote_id=990,
repository__owner="imosley",
Expand All @@ -96,7 +96,7 @@ def generate_services_with_environments(service_factory, environment_factory):
docs_url="https://docsurl",
pagerduty_service="/services",
slack_channel="https://slackchannel",
status="fixed",
lifecycle="fixed",
repository__id=78,
repository__remote_id=239,
repository__owner="jasckson",
Expand Down Expand Up @@ -131,7 +131,7 @@ def generate_services_with_links(service_factory, link_factory):
docs_url="https://docsurl",
pagerduty_service="/services",
slack_channel="https://slackchannel",
status="fixed",
lifecycle="fixed",
repository__id=78,
repository__remote_id=239,
repository__owner="jasckson",
Expand Down
7 changes: 4 additions & 3 deletions test/entities/test_objects_to_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

@pytest.fixture
def generate_base_component(component_base_factory, link_factory, group_factory):
group = group_factory(id=1, product_owner="john", project_owner="doe")
group.save()
component = component_base_factory(
id=1,
name="base",
Expand All @@ -26,9 +24,12 @@ def generate_base_component(component_base_factory, link_factory, group_factory)
source__owner="jasckson",
source__name="thiwer",
source__url="https://gitlab.com/thiwer/thiwer",
group=group,
)
component.save()

group = group_factory(id=1, product_owner="john", project_owner="doe", entity=component)
group.save()

link_factory(
id=1,
name="Datadog",
Expand Down
Loading

0 comments on commit e3c8f58

Please sign in to comment.