Skip to content

Commit

Permalink
Test that anonymous user is not accepted
Browse files Browse the repository at this point in the history
  • Loading branch information
icppWorld committed Sep 8, 2023
1 parent e7a5d17 commit 7b75200
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions icpp_llama2/test/test_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,45 @@ def test__reset_model_err(identity_anonymous: dict[str, str], network: str) -> N
assert response == expected_response


def test__inference_1(identity_anonymous: dict[str, str], network: str) -> None:
def test__new_chat_anonymous(identity_anonymous: dict[str, str], network: str) -> None:
response = call_canister_api(
dfx_json_path=DFX_JSON_PATH,
canister_name=CANISTER_NAME,
canister_method="new_chat",
canister_argument="()",
network=network,
timeout_seconds=10,
)
assert "err" in response


def test__new_chat(identity_default: dict[str, str], network: str) -> None:
response = call_canister_api(
dfx_json_path=DFX_JSON_PATH,
canister_name=CANISTER_NAME,
canister_method="new_chat",
canister_argument="()",
network=network,
timeout_seconds=10,
)
assert "ok" in response


def test__inference_1_anonymous(
identity_anonymous: dict[str, str], network: str
) -> None:
response = call_canister_api(
dfx_json_path=DFX_JSON_PATH,
canister_name=CANISTER_NAME,
canister_method="inference",
canister_argument='(record {prompt = "" : text; steps = 19 : nat64; temperature = 0.9 : float32; topp = 0.9 : float32; rng_seed = 0 : nat64;})',
network=network,
timeout_seconds=10,
)
assert "err" in response


def test__inference_1(identity_default: dict[str, str], network: str) -> None:
response = call_canister_api(
dfx_json_path=DFX_JSON_PATH,
canister_name=CANISTER_NAME,
Expand All @@ -69,7 +107,7 @@ def test__inference_1(identity_anonymous: dict[str, str], network: str) -> None:
assert "ok" in response


def test__inference_2(identity_anonymous: dict[str, str], network: str) -> None:
def test__inference_2(identity_default: dict[str, str], network: str) -> None:
response = call_canister_api(
dfx_json_path=DFX_JSON_PATH,
canister_name=CANISTER_NAME,
Expand Down

0 comments on commit 7b75200

Please sign in to comment.