-
Notifications
You must be signed in to change notification settings - Fork 9
Feature: get_program_price #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e4a2416
Feature: get_program_price functions
1yam f39085c
Fix: add also to abstract AlehpClient
1yam 94a1bc8
Fix: black issue
1yam d206c0c
Fix: add superfuild to pyproject.toml
1yam 874619c
Revert "Fix: add superfuild to pyproject.toml"
1yam d6a3ec5
Fix: isort issue
1yam 6e0de2c
Fix: type
1yam bc74994
Fix: unit test
1yam 9cf9a48
Fix: style issue
1yam 3696bad
Update src/aleph/sdk/client/http.py
1yam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import pytest | ||
|
|
||
| from aleph.sdk.exceptions import InvalidHashError | ||
| from aleph.sdk.query.responses import PriceResponse | ||
| from tests.unit.conftest import make_mock_get_session, make_mock_get_session_400 | ||
|
|
||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_get_program_price_valid(): | ||
1yam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| """ | ||
| Test that the get_program_price method returns the correct PriceResponse | ||
| when given a valid item hash. | ||
| """ | ||
| expected_response = { | ||
| "required_tokens": 3.0555555555555556e-06, | ||
| "payment_type": "superfluid", | ||
| } | ||
| mock_session = make_mock_get_session(expected_response) | ||
| async with mock_session: | ||
| response = await mock_session.get_program_price("cacacacacacaca") | ||
| assert response == PriceResponse(**expected_response) | ||
|
|
||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_get_program_price_invalid(): | ||
| """ | ||
| Test that the get_program_price method raises an InvalidHashError | ||
| when given an invalid item hash. | ||
| """ | ||
| mock_session = make_mock_get_session_400({"error": "Invalid hash"}) | ||
| async with mock_session: | ||
| with pytest.raises(InvalidHashError): | ||
| await mock_session.get_program_price("invalid_item_hash") | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.