You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I use netflix-dgs-authorisation-directive in my app and want to test mutations which annotated with @secured .
When I'm trying test it like regular mutation without @secured I get exception
java.lang.ClassCastException: class com.netflix.graphql.dgs.internal.DgsWebMvcRequestData cannot be cast to class test.com.config.GraphQLContext
GraphQLContext - it's my custom class for context, so decided mock DgsContext, but it was unsuccessful, also I tried mock GqlContextBuilder and DgsWebMvcRequestData, but it also was unsuccessful.
Also I looked for best practice for testing with authorisation directives in dgs docs but there nothing about that.
May be there is somewhere best practice or examples of such test ?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I use netflix-dgs-authorisation-directive in my app and want to test mutations which annotated with
@secured.When I'm trying test it like regular mutation without
@securedI get exceptionjava.lang.ClassCastException: class com.netflix.graphql.dgs.internal.DgsWebMvcRequestData cannot be cast to class test.com.config.GraphQLContextGraphQLContext - it's my custom class for context, so decided mock DgsContext, but it was unsuccessful, also I tried mock GqlContextBuilder and DgsWebMvcRequestData, but it also was unsuccessful.
Also I looked for best practice for testing with authorisation directives in dgs docs but there nothing about that.
May be there is somewhere best practice or examples of such test ?
Beta Was this translation helpful? Give feedback.
All reactions