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

Commit

Permalink
works
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnii committed Oct 29, 2019
1 parent 6447e29 commit 37bea5b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion integration_tests/service_a/src/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def resolve_posts(root, info):
Post(id=1, title='title1', text=FunnyText(id=1), files=[FileNode(id=1)]),
Post(id=2, title='title2', text=FunnyText(id=2), files=[FileNode(id=2), FileNode(id=3)]),
Post(id=3, title='title3', text=FunnyText(id=3)),
Post(id=4, title='title4', text=FunnyText(id=4), author=User(name="frank")),
Post(id=4, title='title4', text=FunnyText(id=4), author=User(email="frank@frank.com")),
]

def resolve_goodbye(root, info):
Expand Down
5 changes: 4 additions & 1 deletion integration_tests/service_b/src/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ class User(ObjectType):
def __resolve_reference(self, info, **kwargs):
if hasattr(info, 'id'):
return User(id=self.id, email=f'name_{self.id}')
return User(id=hash(info.email) % 10000000, email=self.email)

user_id = 1001 if self.email == "frank@frank.com" else hash(self.email) % 10000000

return User(id=user_id, email=self.email)


# to test that @key applied only to FileNode, but not to FileNodeAnother
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/tests/tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_external_types():
assert {"id": 3, "body": "funny_text_3"} == posts[2]['text']
assert posts[3]["author"] is not None
author = posts[3]["author"]
assert {"id": 100, "email": "frank", } == author
assert {"id": 1001, "email": "frank@frank.com", } == author


def fetch_sdl():
Expand Down

0 comments on commit 37bea5b

Please sign in to comment.