diff --git a/packages/plugins/minos-router-graphql/minos/plugins/graphql/schema_builder.py b/packages/plugins/minos-router-graphql/minos/plugins/graphql/schema_builder.py index 5bc97ec28..29556868e 100644 --- a/packages/plugins/minos-router-graphql/minos/plugins/graphql/schema_builder.py +++ b/packages/plugins/minos-router-graphql/minos/plugins/graphql/schema_builder.py @@ -13,7 +13,8 @@ GraphQLArgument, GraphQLField, GraphQLObjectType, - GraphQLSchema, GraphQLString, + GraphQLSchema, + GraphQLString, ) from minos.networks import ( @@ -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) diff --git a/packages/plugins/minos-router-graphql/tests/test_graphql/test_routers.py b/packages/plugins/minos-router-graphql/tests/test_graphql/test_routers.py index 7a1be2d05..4f88c7c27 100644 --- a/packages/plugins/minos-router-graphql/tests/test_graphql/test_routers.py +++ b/packages/plugins/minos-router-graphql/tests/test_graphql/test_routers.py @@ -1,8 +1,8 @@ import unittest from graphql import ( - validate_schema, GraphQLSchema, + validate_schema, ) from minos.common import ( diff --git a/packages/plugins/minos-router-graphql/tests/test_graphql/test_schema_builder.py b/packages/plugins/minos-router-graphql/tests/test_graphql/test_schema_builder.py index bcbd99a12..59c20ea86 100644 --- a/packages/plugins/minos-router-graphql/tests/test_graphql/test_schema_builder.py +++ b/packages/plugins/minos-router-graphql/tests/test_graphql/test_schema_builder.py @@ -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, ) @@ -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) @@ -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) @@ -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) @@ -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)