diff --git a/.github/workflows/dependabot_auto_approve.yaml b/.github/workflows/dependabot_auto_approve.yaml new file mode 100644 index 0000000..d550d54 --- /dev/null +++ b/.github/workflows/dependabot_auto_approve.yaml @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2024 Benjamin Thomas Schwertfeger +# GitHub: https://github.com/btschwertfeger +# +# Workflow that approves and merges all pull requests from the dependabot[bot] +# author. +# +# Source (May, 2024): +# - https://blog.somewhatabstract.com/2021/10/11/setting-up-dependabot-with-github-actions-to-approve-and-merge/ + +name: Dependabot auto-merge +on: pull_request_target + +permissions: + pull-requests: write + contents: write + +jobs: + dependabot: + runs-on: ubuntu-latest + if: ${{ github.actor == 'dependabot[bot]' }} + steps: + - name: Dependabot metadata + id: dependabot-metadata + uses: dependabot/fetch-metadata@v1.1.1 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Approve a PR + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Enable auto-merge for Dependabot PRs + if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }} + run: gh pr merge --auto --squash "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/kraken/nft/trade.py b/kraken/nft/trade.py index d22e862..0ac608a 100644 --- a/kraken/nft/trade.py +++ b/kraken/nft/trade.py @@ -136,6 +136,8 @@ def modify_auction( """ Modify an existing auction owned by the user + - https://docs.kraken.com/rest/#tag/NFT-Trading/operation/modifyAuction + :param auction_id: ID referencing the auction :type auction_id: str :param ask_price: New ask price (only for fixed price auction type), @@ -183,6 +185,8 @@ def cancel_auction( """ Cancel an existing auction owned by the user + - https://docs.kraken.com/rest/#tag/NFT-Trading/operation/cancelAuction + :param auction_id: IDs referencing the auctions to cancel :type auction_id: list[str] :param otp: One time password, defaults to None diff --git a/tests/nft/test_nft_trade.py b/tests/nft/test_nft_trade.py index 998cc2b..9d0c4ef 100644 --- a/tests/nft/test_nft_trade.py +++ b/tests/nft/test_nft_trade.py @@ -16,7 +16,6 @@ from datetime import datetime, timedelta from kraken.exceptions import ( - KrakenAuctionNotOwnedByUserError, KrakenInvalidArgumentBelowMinError, KrakenInvalidArgumentOfferNotFoundError, KrakenNFTNotAvailableError, @@ -59,15 +58,24 @@ def test_nft_trade_create_auction(nft_auth_trade: Trade) -> None: @pytest.mark.nft_auth() @pytest.mark.nft_trade() def test_nft_trade_modify_auction(nft_auth_trade: Trade) -> None: - """Checks the ``modify_auction`` endpoint.""" + """ + Checks the ``modify_auction`` endpoint. + It is sufficient here to check that the request is valid, even if the + auction is not valid. + """ - with pytest.raises(KrakenAuctionNotOwnedByUserError): - nft_auth_trade.modify_auction( - auction_id="AT2POJ-4CH3O-4TH6JH", - ask_price="0.3", - ) + response = nft_auth_trade.modify_auction( + auction_id="AT2POJ-4CH3O-4TH6JH", + ask_price="0.3", + ) + assert isinstance(response, dict) + assert response.get( + "error", + [], + ) == ["EAPI:Invalid arguments:No auction with the provided ID"] +@pytest.mark.wip() @pytest.mark.nft() @pytest.mark.nft_auth() @pytest.mark.nft_trade() @@ -83,7 +91,7 @@ def test_nft_trade_cancel_auction(nft_auth_trade: Trade) -> None: assert isinstance(result["statuses"][0], dict) assert result["statuses"][0].get("id") == "AT2POJ-4CH3O-4TH6JH" assert result["statuses"][0].get("status") == "failed" - assert result["statuses"][0].get("reason") == "no permission" + assert result["statuses"][0].get("reason") == "not found" @pytest.mark.nft()