-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into rasswanth/remove-old-enclave-code
- Loading branch information
Showing
5 changed files
with
108 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,23 +77,50 @@ def test_user_code(worker) -> None: | |
assert multi_call_res.get() == result.get() | ||
|
||
|
||
def test_duplicated_user_code(worker, guest_client: User) -> None: | ||
def test_duplicated_user_code(worker) -> None: | ||
worker.root_client.register( | ||
name="Jane Doe", | ||
email="[email protected]", | ||
password="abc123", | ||
password_verify="abc123", | ||
institution="Caltech", | ||
website="https://www.caltech.edu/", | ||
) | ||
ds_client = worker.root_client.login( | ||
email="[email protected]", | ||
password="abc123", | ||
) | ||
|
||
# mock_syft_func() | ||
result = guest_client.api.services.code.request_code_execution(mock_syft_func) | ||
result = ds_client.api.services.code.request_code_execution(mock_syft_func) | ||
assert isinstance(result, Request) | ||
assert len(guest_client.code.get_all()) == 1 | ||
assert len(ds_client.code.get_all()) == 1 | ||
|
||
# request the exact same code should return an error | ||
result = guest_client.api.services.code.request_code_execution(mock_syft_func) | ||
result = ds_client.api.services.code.request_code_execution(mock_syft_func) | ||
assert isinstance(result, SyftError) | ||
assert len(guest_client.code.get_all()) == 1 | ||
assert len(ds_client.code.get_all()) == 1 | ||
|
||
# request the a different function name but same content will also succeed | ||
# flaky if not blocking | ||
mock_syft_func_2(syft_no_node=True) | ||
result = guest_client.api.services.code.request_code_execution(mock_syft_func_2) | ||
result = ds_client.api.services.code.request_code_execution(mock_syft_func_2) | ||
assert isinstance(result, Request) | ||
assert len(guest_client.code.get_all()) == 2 | ||
assert len(ds_client.code.get_all()) == 2 | ||
|
||
code_history = ds_client.code_history | ||
assert code_history.code_versions, "No code version found." | ||
|
||
code_histories = worker.root_client.code_histories | ||
user_code_history = code_histories[ds_client.logged_in_user] | ||
assert not isinstance(code_histories, SyftError) | ||
assert not isinstance(user_code_history, SyftError) | ||
assert user_code_history.code_versions, "No code version found." | ||
assert user_code_history.mock_syft_func.user_code_history[0].status is not None | ||
assert user_code_history.mock_syft_func[0]._repr_markdown_(), "repr markdown failed" | ||
|
||
result = user_code_history.mock_syft_func_2[0]() | ||
assert result.get() == 1 | ||
|
||
|
||
def random_hash() -> str: | ||
|