Page MenuHomeSoftware Heritage

tests: Explicit the bad request scenario error message
ClosedPublic

Authored by ardumont on Sep 28 2020, 5:45 PM.

Details

Summary

Multiple existing tests were not properly configured [1] and checking multiple times the same scenario.
This makes sure this will not happen again.

[1] D4057 D4060

Test Plan

tox

Diff Detail

Repository
rDDEP Push deposit
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D4069 (id=14361)

Could not rebase; Attempt merge onto 87b39c10ee...

Updating 87b39c10..42b7ae13
Fast-forward
 swh/deposit/api/checks.py                          |  2 ++
 swh/deposit/parsers.py                             | 11 ++++++-
 swh/deposit/tests/api/test_deposit_atom.py         | 18 ++++++-----
 swh/deposit/tests/api/test_deposit_binary.py       | 13 ++++++++
 swh/deposit/tests/api/test_deposit_delete.py       |  8 +++++
 .../api/test_deposit_private_read_metadata.py      |  8 -----
 .../api/test_deposit_private_update_status.py      |  5 +++
 swh/deposit/tests/api/test_deposit_update.py       | 37 ++++++++++------------
 swh/deposit/tests/api/test_parser.py               |  4 ---
 .../atom/entry-data-empty-body-no-namespace.xml    |  2 ++
 .../tests/data/atom/entry-data-empty-body.xml      |  2 +-
 swh/deposit/tests/data/atom/entry-data3.xml        |  2 +-
 12 files changed, 69 insertions(+), 43 deletions(-)
 create mode 100644 swh/deposit/tests/data/atom/entry-data-empty-body-no-namespace.xml
Changes applied before test
commit 42b7ae135c51e6fd69ebbe6c2591e23e04cc2aff
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Sep 28 17:44:06 2020 +0200

    tests: Ensure all 400 scenarios check the correct response
    
    It has been detected at least one of the scenario was wrong already. This makes
    sure we do not reproduce that error.

commit 73120b72171c1f8884ab5d63da8fe0a7e25ea391
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Sep 28 16:18:37 2020 +0200

    tests: Ensure all empty body test cases are covered

commit d86c192234a025a027202379789e074441dadbc3
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Sep 28 16:09:59 2020 +0200

    deposit.parsers: Process namespace when using xmltodict.parse
    
    This keeps the existing behavior though by mapping the expanded name to simpler
    namespaces.
    
    This also fixes some test data sample which were not properly defining their
    namespace.
    
    This will allow to deal more properly the empty body case which is incomplete
    right now.

commit cc8d12524845811345735a00e836f29dea8fac8c
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Sep 28 14:15:48 2020 +0200

    deposit.api.checks: Add docstring to module

See https://jenkins.softwareheritage.org/job/DDEP/job/tests-on-diff/156/ for more details.

ardumont retitled this revision from tests: Ensure all 400 scenarios check the correct response to tests: Explicit the bad request scenario error message.Sep 28 2020, 5:52 PM
ardumont edited the summary of this revision. (Show Details)

Build is green

Patch application report for D4069 (id=14364)

Could not rebase; Attempt merge onto 87b39c10ee...

Updating 87b39c10..54944e45
Fast-forward
 swh/deposit/parsers.py                             | 11 ++++++-
 swh/deposit/tests/api/test_deposit_atom.py         | 18 ++++++-----
 swh/deposit/tests/api/test_deposit_binary.py       | 13 ++++++++
 swh/deposit/tests/api/test_deposit_delete.py       |  8 +++++
 .../api/test_deposit_private_read_metadata.py      |  8 -----
 .../api/test_deposit_private_update_status.py      |  5 +++
 swh/deposit/tests/api/test_deposit_update.py       | 37 ++++++++++------------
 swh/deposit/tests/api/test_parser.py               |  4 ---
 .../atom/entry-data-empty-body-no-namespace.xml    |  2 ++
 .../tests/data/atom/entry-data-empty-body.xml      |  2 +-
 swh/deposit/tests/data/atom/entry-data3.xml        |  2 +-
 11 files changed, 67 insertions(+), 43 deletions(-)
 create mode 100644 swh/deposit/tests/data/atom/entry-data-empty-body-no-namespace.xml
Changes applied before test
commit 54944e45c5f1725db47a8a811b2863c38bda6375
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Sep 28 17:44:06 2020 +0200

    tests: Ensure all 400 scenarios check the correct response
    
    It has been detected at least one of the scenario was wrong already. This makes
    sure we do not reproduce that error.

commit b15033d6ce7c4b60cbf0c82c299a0ed322e7e2e7
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Sep 28 16:18:37 2020 +0200

    tests: Ensure all empty body test cases are covered

commit f05480888a317c5cbc181ebdaa8d98e58914cc06
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Sep 28 16:09:59 2020 +0200

    deposit.parsers: Process namespace when using xmltodict.parse
    
    This keeps the existing behavior though by mapping the expanded name to simpler
    namespaces.
    
    This also fixes some test data sample which were not properly defining their
    namespace.
    
    This will allow to deal more properly the empty body case which is incomplete
    right now.

See https://jenkins.softwareheritage.org/job/DDEP/job/tests-on-diff/159/ for more details.

Build is green

Patch application report for D4069 (id=14365)

Could not rebase; Attempt merge onto 87b39c10ee...

Updating 87b39c10..8d4f19a3
Fast-forward
 swh/deposit/parsers.py                             | 11 ++++++-
 swh/deposit/tests/api/test_deposit_atom.py         | 18 ++++++-----
 swh/deposit/tests/api/test_deposit_binary.py       | 13 ++++++++
 swh/deposit/tests/api/test_deposit_delete.py       |  8 +++++
 .../api/test_deposit_private_read_metadata.py      |  8 -----
 .../api/test_deposit_private_update_status.py      |  5 +++
 swh/deposit/tests/api/test_deposit_update.py       | 37 ++++++++++------------
 swh/deposit/tests/api/test_parser.py               |  4 ---
 .../atom/entry-data-empty-body-no-namespace.xml    |  2 ++
 .../tests/data/atom/entry-data-empty-body.xml      |  2 +-
 swh/deposit/tests/data/atom/entry-data3.xml        |  2 +-
 11 files changed, 67 insertions(+), 43 deletions(-)
 create mode 100644 swh/deposit/tests/data/atom/entry-data-empty-body-no-namespace.xml
Changes applied before test
commit 8d4f19a3f3cfeb13728beb666111977d441e6c7d
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Sep 28 17:44:06 2020 +0200

    tests: Explicit the bad request scenario error messages
    
    Multiple existing tests were not properly configured [1] and checking multiple times the same scenario.
    This makes sure this will not happen again.
    
    [1] D4057 D4060

commit b15033d6ce7c4b60cbf0c82c299a0ed322e7e2e7
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Sep 28 16:18:37 2020 +0200

    tests: Ensure all empty body test cases are covered

commit f05480888a317c5cbc181ebdaa8d98e58914cc06
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Sep 28 16:09:59 2020 +0200

    deposit.parsers: Process namespace when using xmltodict.parse
    
    This keeps the existing behavior though by mapping the expanded name to simpler
    namespaces.
    
    This also fixes some test data sample which were not properly defining their
    namespace.
    
    This will allow to deal more properly the empty body case which is incomplete
    right now.

See https://jenkins.softwareheritage.org/job/DDEP/job/tests-on-diff/160/ for more details.

This revision is now accepted and ready to land.Sep 28 2020, 6:09 PM