Skip to content
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

[23.2] Fix test_page_encoding and test_collection_explicit_and_implicit integration tests #17584

Conversation

nsoranzo
Copy link
Member

@nsoranzo nsoranzo commented Mar 4, 2024

Don't assume that the history has unencoded id 1.

Broken by commit 85630e2 .

Fix the following error:

______________ TestPageJsonEncodingIntegration.test_page_encoding ______________

self = <integration.test_page_revision_json_encoding.TestPageJsonEncodingIntegration object at 0x7fe178521190>
history_id = '529fd61ab1c6cc36'

    def test_page_encoding(self, history_id: str):
        request = dict(
            slug="mypage",
            title="MY PAGE",
            content=f"""<p>Page!<div class="embedded-item" id="History-{history_id}"></div></p>""",
        )
        page_response = self._post("pages", request, json=True)
        api_asserts.assert_status_code_is_ok(page_response)
        sa_session = self._app.model.session
        page_revision = sa_session.scalars(select(model.PageRevision).filter_by(content_format="html")).all()[0]
>       assert '''id="History-1"''' in page_revision.content, page_revision.content
E       AssertionError: <p>Page!</p><div class="embedded-item history placeholder" id="History-2"><p class="title">Embedded Galaxy History - 'test_history'</p><p class="content">[Do not edit this block; Galaxy will fill it in with the annotated History when it is displayed]</p></div><p></p>
E       assert 'id="History-1"' in '<p>Page!</p><div class="embedded-item history placeholder" id="History-2"><p class="title">Embedded Galaxy History - \'test_history\'</p><p class="content">[Do not edit this block; Galaxy will fill it in with the annotated History when it is displayed]</p></div><p></p>'
E        +  where '<p>Page!</p><div class="embedded-item history placeholder" id="History-2"><p class="title">Embedded Galaxy History - \'test_history\'</p><p class="content">[Do not edit this block; Galaxy will fill it in with the annotated History when it is displayed]</p></div><p></p>' = <galaxy.model.PageRevision(1) at 0x7fe0d74d81d0>.content

test/integration/test_page_revision_json_encoding.py:33: AssertionError

Fix also the test_collection_explicit_and_implicit integration test, which also started failing from the same commit but was always broken.

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

Don't assume that the history has unencoded id 1.

Broken by commit 85630e2 .

Fix the following error:

```
______________ TestPageJsonEncodingIntegration.test_page_encoding ______________

self = <integration.test_page_revision_json_encoding.TestPageJsonEncodingIntegration object at 0x7fe178521190>
history_id = '529fd61ab1c6cc36'

    def test_page_encoding(self, history_id: str):
        request = dict(
            slug="mypage",
            title="MY PAGE",
            content=f"""<p>Page!<div class="embedded-item" id="History-{history_id}"></div></p>""",
        )
        page_response = self._post("pages", request, json=True)
        api_asserts.assert_status_code_is_ok(page_response)
        sa_session = self._app.model.session
        page_revision = sa_session.scalars(select(model.PageRevision).filter_by(content_format="html")).all()[0]
>       assert '''id="History-1"''' in page_revision.content, page_revision.content
E       AssertionError: <p>Page!</p><div class="embedded-item history placeholder" id="History-2"><p class="title">Embedded Galaxy History - 'test_history'</p><p class="content">[Do not edit this block; Galaxy will fill it in with the annotated History when it is displayed]</p></div><p></p>
E       assert 'id="History-1"' in '<p>Page!</p><div class="embedded-item history placeholder" id="History-2"><p class="title">Embedded Galaxy History - \'test_history\'</p><p class="content">[Do not edit this block; Galaxy will fill it in with the annotated History when it is displayed]</p></div><p></p>'
E        +  where '<p>Page!</p><div class="embedded-item history placeholder" id="History-2"><p class="title">Embedded Galaxy History - \'test_history\'</p><p class="content">[Do not edit this block; Galaxy will fill it in with the annotated History when it is displayed]</p></div><p></p>' = <galaxy.model.PageRevision(1) at 0x7fe0d74d81d0>.content

test/integration/test_page_revision_json_encoding.py:33: AssertionError
```
which was working only because `workflow_id` and `history_id` were the
same before commit 85630e2 .
@nsoranzo nsoranzo changed the title [23.2] Fix test_page_encoding test [23.2] Fix test_page_encoding and test_collection_explicit_and_implicit integration tests Mar 4, 2024
@nsoranzo
Copy link
Member Author

nsoranzo commented Mar 4, 2024

Failing tests unrelated.

@jdavcs jdavcs merged commit ac9a6b4 into galaxyproject:release_23.2 Mar 4, 2024
37 of 48 checks passed
@nsoranzo nsoranzo deleted the release_23.2_fix_test_page_encoding branch March 4, 2024 18:06
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.

3 participants