Skip to content

Update Sanic adapter unit tests to be compatible with the latest version - #187

Merged
seratch merged 1 commit into
slackapi:mainfrom
seratch:sanic-test
Jan 4, 2021
Merged

seratch merged 1 commit into
slackapi:mainfrom
seratch:sanic-test

Conversation

@seratch

@seratch seratch commented Jan 4, 2021

Copy link
Copy Markdown
Contributor

The latest version of Sanic web framework verifies if Sanic app names are duplicated in the same Python process.

$ pip install -U sanic
Installing collected packages: sanic
  Attempting uninstall: sanic
    Found existing installation: sanic 20.9.1
    Uninstalling sanic-20.9.1:
      Successfully uninstalled sanic-20.9.1
Successfully installed sanic-20.12.0

$ ./scripts/run_tests.sh tests/adapter_tests_async/test_async_sanic.py

tests/adapter_tests_async/test_async_sanic.py .FFF                                                                                             [100%]
====================================================================== FAILURES ======================================================================
______________________________________________________________ TestSanic.test_shortcuts ______________________________________________________________

self = <tests.adapter_tests_async.test_async_sanic.TestSanic object at 0x10a2c6c10>

    @pytest.mark.asyncio
    async def test_shortcuts(self):
        app = AsyncApp(
            client=self.web_client,
            signing_secret=self.signing_secret,
        )

        async def shortcut_handler(ack):
            await ack()

        app.shortcut("test-shortcut")(shortcut_handler)

        input = {
            "type": "shortcut",
            "token": "verification_token",
            "action_ts": "111.111",
            "team": {
                "id": "T111",
                "domain": "workspace-domain",
                "enterprise_id": "E111",
                "enterprise_name": "Org Name",
            },
            "user": {"id": "W111", "username": "primary-owner", "team_id": "T111"},
            "callback_id": "test-shortcut",
            "trigger_id": "111.111.xxxxxx",
        }

        timestamp, body = str(int(time())), f"payload={quote(json.dumps(input))}"

>       api = Sanic(name="awesome-slack-app")

tests/adapter_tests_async/test_async_sanic.py:140:

Category (place an x in each of the [ ])

  • slack_bolt.App and/or its core components
  • slack_bolt.async_app.AsyncApp and/or its core components
  • Adapters in slack_bolt.adapter
  • Document pages under /docs
  • Others (tests)

Requirements (place an x in each [ ])

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run ./scripts/install_all_and_run_tests.sh after making the changes.

@codecov

codecov Bot commented Jan 4, 2021

Copy link
Copy Markdown

Codecov Report

Merging #187 (7066683) into main (4660bbc) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #187   +/-   ##
=======================================
  Coverage   91.77%   91.77%           
=======================================
  Files         149      149           
  Lines        4448     4448           
=======================================
  Hits         4082     4082           
  Misses        366      366           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4660bbc...7066683. Read the comment docs.

@seratch
seratch merged commit 2216935 into slackapi:main Jan 4, 2021
@seratch
seratch deleted the sanic-test branch January 4, 2021 05:03
@seratch seratch modified the milestones: 1.2.0, 1.1.5 Jan 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant