Skip to content

Commit

Permalink
Add invalid input testcase and fix invalid testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
p-rial committed Sep 1, 2021
1 parent 821cb1e commit 965a471
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions tests/client/client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,14 +554,17 @@ def test_get_data_source_success(pyband_client):


def test_get_data_source_invalid(pyband_client):
with pytest.raises(ValueError):
pyband_client.get_data_source(-1)
with pytest.raises(grpc.RpcError):
pyband_client.get_data_source(0)


def test_get_data_source_invalid_input(pyband_client):
with pytest.raises(TypeError):
pyband_client.get_data_source("hi")

with pytest.raises(ValueError):
pyband_client.get_data_source(-1)


def test_get_oracle_script_success(pyband_client):
oracle_script = pyband_client.get_oracle_script(1)
Expand All @@ -577,14 +580,17 @@ def test_get_oracle_script_success(pyband_client):


def test_get_oracle_script_invalid(pyband_client):
with pytest.raises(ValueError):
pyband_client.get_oracle_script(-1)
with pytest.raises(grpc.RpcError):
pyband_client.get_oracle_script(0)


def test_get_oracle_script_invalid_input(pyband_client):
with pytest.raises(TypeError):
pyband_client.get_oracle_script("hi")

with pytest.raises(ValueError):
pyband_client.get_oracle_script(-1)


def test_get_request_by_id_success(pyband_client):
response = pyband_client.get_request_by_id(1)
Expand Down Expand Up @@ -642,15 +648,18 @@ def test_get_request_by_id_invalid_input(pyband_client):
with pytest.raises(TypeError):
pyband_client.get_request_by_id("hi")

with pytest.raises(ValueError):
pyband_client.get_request_by_id(-1)


def test_get_request_by_id_not_found(pyband_client):
with pytest.raises(grpc.RpcError):
pyband_client.get_request_by_id(1234556)


def test_get_request_by_id_invalid(pyband_client):
with pytest.raises(ValueError):
pyband_client.get_request_by_id(-1)
with pytest.raises(grpc.RpcError):
pyband_client.get_request_by_id(0)


def test_get_reporters_success(pyband_client):
Expand Down

0 comments on commit 965a471

Please sign in to comment.