Skip to content

Commit

Permalink
Added the test suite back.
Browse files Browse the repository at this point in the history
  • Loading branch information
mariacarmina committed Oct 5, 2023
1 parent 2c9de9f commit f9f6dd2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ jobs:
cat $HOME/.ocean/ocean-contracts/artifacts/address.json
- name: Test with pytest
run: |
pytest tests/test_download.py::test_consume_algo_with_credentials
pytest ocean_provider/validation/test/test_algo_validation.py::test_algo_credentials
coverage run --source ocean_provider -m pytest
coverage report
coverage xml
- name: docker logs
run: docker logs ocean_aquarius_1 && docker logs ocean_provider_1 && docker logs ocean_provider2_1 && docker logs ocean_ipfs_1
if: ${{ failure() }}
Expand Down
4 changes: 1 addition & 3 deletions ocean_provider/utils/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,8 @@ def get_asset_from_metadatastore(metadata_url, document_id) -> Optional[Asset]:
def check_asset_consumable(asset, consumer_address, logger, custom_url=None):
if not asset.nft or "address" not in asset.nft or not asset.chain_id:
return False, "Asset malformed or disabled."
web3 = get_web3(asset.chain_id)
nft_contract = get_data_nft_contract(web3, asset.nft["address"])

if nft_contract.caller.getMetaData()[2] not in [0, 5]:
if asset.nft["state"] not in [0, 5]:
return False, "Asset is not consumable."

code = asset.is_consumable({"type": "address", "value": consumer_address})
Expand Down
2 changes: 1 addition & 1 deletion ocean_provider/utils/data_nft.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def get_data_nft_contract(web3: Web3, address: Optional[str] = None) -> Contract
especially the `getMetaData` contract method.
"""
abi = get_contract_definition("ERC721Template")["abi"]
return web3.eth.contract(address=address, abi=abi)
return web3.eth.contract(address=web3.toChecksumAddress(address), abi=abi)


def get_metadata(web3: Web3, address: str) -> Tuple[str, str, MetadataState, bool]:
Expand Down

0 comments on commit f9f6dd2

Please sign in to comment.