diff --git a/pyband/client.py b/pyband/client.py index 9ced582..b89c480 100644 --- a/pyband/client.py +++ b/pyband/client.py @@ -45,7 +45,7 @@ def get_oracle_script(self, id: int) -> oracle_type.OracleScript: def get_request_by_id(self, id: int) -> oracle_query.QueryRequestResponse: return self.stubOracle.Request(oracle_query.QueryRequestRequest(request_id=id)) - def get_reporters(self, validator: str) -> oracle_type.ReportersPerValidator.reporters: + def get_reporters(self, validator: str) -> oracle_query.QueryReportersResponse.reporter: return self.stubOracle.Reporters(oracle_query.QueryReportersRequest(validator_address=validator)).reporter def get_latest_block(self) -> tendermint_query.GetLatestBlockResponse: diff --git a/pyband/exceptions.py b/pyband/exceptions.py index 535890b..ebc41e6 100644 --- a/pyband/exceptions.py +++ b/pyband/exceptions.py @@ -2,26 +2,10 @@ class PybandError(Exception): pass -class EmptyRequestMsgError(PybandError): - pass - - -class QueryError(PybandError): - pass - - -class NegativeIntegerError(PybandError): - pass - - class ValueTooLargeError(PybandError): pass -class InsufficientCoinError(PybandError): - pass - - class EmptyMsgError(PybandError): pass @@ -42,13 +26,5 @@ class ConvertError(PybandError): pass -class UnsuccessfulCallError(PybandError): - pass - - -class CreateError(PybandError): - pass - - class SchemaError(PybandError): pass diff --git a/pyband/proto/.DS_Store b/pyband/proto/.DS_Store deleted file mode 100644 index 903326a..0000000 Binary files a/pyband/proto/.DS_Store and /dev/null differ diff --git a/tests/client/client_test.py b/tests/client/client_test.py index 8fb0b23..8afb121 100644 --- a/tests/client/client_test.py +++ b/tests/client/client_test.py @@ -555,13 +555,16 @@ def test_get_data_source_success(pyband_client): def test_get_data_source_invalid(pyband_client): with pytest.raises(grpc.RpcError): - pyband_client.get_data_source(-1) + 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) @@ -578,13 +581,16 @@ def test_get_oracle_script_success(pyband_client): def test_get_oracle_script_invalid(pyband_client): with pytest.raises(grpc.RpcError): - pyband_client.get_oracle_script(-1) + 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) @@ -642,6 +648,9 @@ 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): @@ -650,7 +659,7 @@ def test_get_request_by_id_not_found(pyband_client): def test_get_request_by_id_invalid(pyband_client): with pytest.raises(grpc.RpcError): - pyband_client.get_request_by_id(-1) + pyband_client.get_request_by_id(0) def test_get_reporters_success(pyband_client):