Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
GraphQLArgument,
GraphQLField,
GraphQLObjectType,
GraphQLSchema, GraphQLString,
GraphQLSchema,
GraphQLString,
)

from minos.networks import (
Expand Down Expand Up @@ -60,11 +61,9 @@ def _build_queries(cls, routes):
if route.KIND == EnrouteDecoratorKind.Query:
fields[route.name] = cls._build_field(route, callback)

result = GraphQLObjectType("Query", fields={
'hello': GraphQLField(
GraphQLString,
resolve=lambda obj, info: 'world')
})
result = GraphQLObjectType(
"Query", fields={"hello": GraphQLField(GraphQLString, resolve=lambda obj, info: "world")}
)
if len(fields) > 0:
result = GraphQLObjectType("Query", fields=fields)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import unittest

from graphql import (
validate_schema,
GraphQLSchema,
validate_schema,
)

from minos.common import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
import unittest

from graphql import (
GraphQLString,
graphql_sync,
validate_schema, GraphQLString,
validate_schema,
)

from minos.common import (
MinosConfig,
)
from minos.networks import (
Request,
Response,
)
from minos.common import (
MinosConfig,
)
from minos.plugins.graphql import (
GraphQlEnroute,
GraphQlHttpRouter,
GraphQLSchemaBuilder,
)
from minos.plugins.graphql.decorators import GraphQlCommandEnrouteDecorator, GraphQlQueryEnrouteDecorator

from minos.plugins.graphql.decorators import (
GraphQlCommandEnrouteDecorator,
GraphQlQueryEnrouteDecorator,
)
from tests.utils import (
BASE_PATH,
)
Expand All @@ -33,12 +37,17 @@ class TestSomething(unittest.TestCase):

def test_build(self):
routes = {
GraphQlCommandEnrouteDecorator(name="order_command", argument=GraphQLString,
output=GraphQLString): callback_fn,
GraphQlCommandEnrouteDecorator(name="ticket_command", argument=GraphQLString,
output=GraphQLString): callback_fn,
GraphQlCommandEnrouteDecorator(
name="order_command", argument=GraphQLString, output=GraphQLString
): callback_fn,
GraphQlCommandEnrouteDecorator(
name="ticket_command", argument=GraphQLString, output=GraphQLString
): callback_fn,
GraphQlQueryEnrouteDecorator(name="order_query", argument=GraphQLString, output=GraphQLString): callback_fn,
GraphQlQueryEnrouteDecorator(name="ticket_query", argument=GraphQLString, output=GraphQLString): callback_fn}
GraphQlQueryEnrouteDecorator(
name="ticket_query", argument=GraphQLString, output=GraphQLString
): callback_fn,
}

schema = GraphQLSchemaBuilder.build(routes=routes)

Expand All @@ -49,7 +58,10 @@ def test_build(self):
def test_build_only_queries(self):
routes = {
GraphQlQueryEnrouteDecorator(name="order_query", argument=GraphQLString, output=GraphQLString): callback_fn,
GraphQlQueryEnrouteDecorator(name="ticket_query", argument=GraphQLString, output=GraphQLString): callback_fn}
GraphQlQueryEnrouteDecorator(
name="ticket_query", argument=GraphQLString, output=GraphQLString
): callback_fn,
}

schema = GraphQLSchemaBuilder.build(routes=routes)

Expand All @@ -59,10 +71,13 @@ def test_build_only_queries(self):

def test_build_only_commands(self):
routes = {
GraphQlCommandEnrouteDecorator(name="order_command", argument=GraphQLString,
output=GraphQLString): callback_fn,
GraphQlCommandEnrouteDecorator(name="ticket_command", argument=GraphQLString,
output=GraphQLString): callback_fn}
GraphQlCommandEnrouteDecorator(
name="order_command", argument=GraphQLString, output=GraphQLString
): callback_fn,
GraphQlCommandEnrouteDecorator(
name="ticket_command", argument=GraphQLString, output=GraphQLString
): callback_fn,
}

schema = GraphQLSchemaBuilder.build(routes=routes)

Expand All @@ -79,7 +94,8 @@ def test_schema_valid(self):

def test_query(self):
routes = {
GraphQlQueryEnrouteDecorator(name="order_query", argument=GraphQLString, output=GraphQLString): callback_fn}
GraphQlQueryEnrouteDecorator(name="order_query", argument=GraphQLString, output=GraphQLString): callback_fn
}

schema = GraphQLSchemaBuilder.build(routes=routes)

Expand Down