Skip to content

Commit

Permalink
Merge pull request #12 from bandprotocol/edit-files
Browse files Browse the repository at this point in the history
Edit files according to new generated code from Proto files
  • Loading branch information
p-rial authored Sep 6, 2021
2 parents d1ac714 + 7c1596f commit df4f752
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 28 deletions.
2 changes: 1 addition & 1 deletion pyband/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
24 changes: 0 additions & 24 deletions pyband/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -42,13 +26,5 @@ class ConvertError(PybandError):
pass


class UnsuccessfulCallError(PybandError):
pass


class CreateError(PybandError):
pass


class SchemaError(PybandError):
pass
Binary file removed pyband/proto/.DS_Store
Binary file not shown.
15 changes: 12 additions & 3 deletions tests/client/client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand Down

0 comments on commit df4f752

Please sign in to comment.