Page MenuHomeSoftware Heritage

tests: Add new ambassador user for frontend tests
ClosedPublic

Authored by ardumont on May 6 2021, 2:09 PM.

Details

Summary

This refactor existing permission code to allow creation of user with some permissions.

Related to T3213

Depends on D5685

Test Plan

tox

Diff Detail

Event Timeline

anlambert added inline comments.
swh/web/tests/create_test_users.py
30

you can remove that assert as the code is already tested

swh/web/tests/test_create_users.py
16

you can drop the is True

swh/web/tests/utils.py
213

create_django_permission is a better name imho

Build is green

Patch application report for D5696 (id=20340)

Could not rebase; Attempt merge onto 43636f47d5...

Updating 43636f47..b4cb2902
Fast-forward
 swh/web/api/views/origin_save.py         |  8 ++---
 swh/web/auth/utils.py                    | 11 +++++++
 swh/web/common/origin_save.py            | 50 ++++++++++++++++++++------------
 swh/web/common/swh_templatetags.py       |  7 +++--
 swh/web/misc/origin_save.py              |  8 +++--
 swh/web/tests/api/test_throttling.py     | 15 +++-------
 swh/web/tests/common/test_origin_save.py | 32 ++++++++++++++++++++
 swh/web/tests/create_test_users.py       | 25 ++++++++++++----
 swh/web/tests/misc/test_origin_save.py   | 45 +++++++++++++++++++++++-----
 swh/web/tests/test_create_users.py       | 16 ++++++++++
 swh/web/tests/utils.py                   | 24 ++++++++++++++-
 11 files changed, 188 insertions(+), 53 deletions(-)
 create mode 100644 swh/web/tests/test_create_users.py
Changes applied before test
commit b4cb2902c730584e9c6f684b70653e34663c654c
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu May 6 14:05:15 2021 +0200

    tests: Add new ambassador user for frontend tests
    
    This refactor existing permission code to allow creation of user with some permissions.
    
    Related to T3213

commit 1a2c53716cbeaedf7492702324fbcfbfd6c9ae18
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Wed May 5 15:25:33 2021 +0200

    Add new bundle type to list only when connected as privileged user
    
    This is only doing listing for now. It's in a dedicated commit so review is easier.
    
    Some more work is required ui and server side to actually schedule those new visit type.
    It will be done in a future commit.
    
    Related to T3213

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

thanks, adapted.

Build is green

Patch application report for D5696 (id=20343)

Could not rebase; Attempt merge onto 43636f47d5...

Updating 43636f47..c89d1c27
Fast-forward
 swh/web/api/views/origin_save.py         |  8 ++---
 swh/web/auth/utils.py                    | 11 +++++++
 swh/web/common/origin_save.py            | 50 ++++++++++++++++++++------------
 swh/web/common/swh_templatetags.py       |  7 +++--
 swh/web/misc/origin_save.py              |  8 +++--
 swh/web/tests/api/test_throttling.py     | 15 +++-------
 swh/web/tests/common/test_origin_save.py | 32 ++++++++++++++++++++
 swh/web/tests/create_test_users.py       | 23 +++++++++++----
 swh/web/tests/misc/test_origin_save.py   | 45 +++++++++++++++++++++++-----
 swh/web/tests/test_create_users.py       | 16 ++++++++++
 swh/web/tests/utils.py                   | 24 ++++++++++++++-
 11 files changed, 186 insertions(+), 53 deletions(-)
 create mode 100644 swh/web/tests/test_create_users.py
Changes applied before test
commit c89d1c270d08fce71b008c0368e13c1337a43d69
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu May 6 14:05:15 2021 +0200

    tests: Add new ambassador user for frontend tests
    
    This refactor existing permission code to allow creation of user with some permissions.
    
    Related to T3213

commit 1a2c53716cbeaedf7492702324fbcfbfd6c9ae18
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Wed May 5 15:25:33 2021 +0200

    Add new bundle type to list only when connected as privileged user
    
    This is only doing listing for now. It's in a dedicated commit so review is easier.
    
    Some more work is required ui and server side to actually schedule those new visit type.
    It will be done in a future commit.
    
    Related to T3213

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

This revision is now accepted and ready to land.May 6 2021, 2:33 PM

Rebase and fix the html comment

Build has FAILED

Patch application report for D5696 (id=20400)

Could not rebase; Attempt merge onto fcf53f1ec3...

Auto-merging swh/web/tests/api/test_throttling.py
Merge made by the 'recursive' strategy.
 swh/web/api/views/origin_save.py         |  8 ++---
 swh/web/auth/utils.py                    | 11 +++++++
 swh/web/common/origin_save.py            | 50 ++++++++++++++++++++------------
 swh/web/common/swh_templatetags.py       |  7 +++--
 swh/web/misc/origin_save.py              |  8 +++--
 swh/web/tests/api/test_throttling.py     | 15 +++-------
 swh/web/tests/common/test_origin_save.py | 32 ++++++++++++++++++++
 swh/web/tests/create_test_users.py       | 23 +++++++++++----
 swh/web/tests/misc/test_origin_save.py   | 45 +++++++++++++++++++++++-----
 swh/web/tests/test_create_users.py       | 16 ++++++++++
 swh/web/tests/utils.py                   | 24 ++++++++++++++-
 11 files changed, 186 insertions(+), 53 deletions(-)
 create mode 100644 swh/web/tests/test_create_users.py
Changes applied before test
commit aa0072d98e96d557f91454031f0603b376e5c2c0
Merge: fcf53f1e c89d1c27
Author: Jenkins user <jenkins@localhost>
Date:   Fri May 7 12:27:37 2021 +0000

    Merge branch 'diff-target' into HEAD

commit c89d1c270d08fce71b008c0368e13c1337a43d69
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu May 6 14:05:15 2021 +0200

    tests: Add new ambassador user for frontend tests
    
    This refactor existing permission code to allow creation of user with some permissions.
    
    Related to T3213

commit 1a2c53716cbeaedf7492702324fbcfbfd6c9ae18
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Wed May 5 15:25:33 2021 +0200

    Add new bundle type to list only when connected as privileged user
    
    This is only doing listing for now. It's in a dedicated commit so review is easier.
    
    Some more work is required ui and server side to actually schedule those new visit type.
    It will be done in a future commit.
    
    Related to T3213

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/798/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/798/console

Build has FAILED

Patch application report for D5696 (id=20403)

Could not rebase; Attempt merge onto fcf53f1ec3...

Updating fcf53f1e..47a07f15
Fast-forward
 swh/web/api/views/origin_save.py         |  8 ++---
 swh/web/auth/utils.py                    | 11 +++++++
 swh/web/common/origin_save.py            | 50 ++++++++++++++++++++------------
 swh/web/common/swh_templatetags.py       |  7 +++--
 swh/web/misc/origin_save.py              |  8 +++--
 swh/web/tests/api/test_throttling.py     | 15 +++-------
 swh/web/tests/common/test_origin_save.py | 32 ++++++++++++++++++++
 swh/web/tests/create_test_users.py       | 23 +++++++++++----
 swh/web/tests/misc/test_origin_save.py   | 45 +++++++++++++++++++++++-----
 swh/web/tests/test_create_users.py       | 16 ++++++++++
 swh/web/tests/utils.py                   | 24 ++++++++++++++-
 11 files changed, 186 insertions(+), 53 deletions(-)
 create mode 100644 swh/web/tests/test_create_users.py
Changes applied before test
commit 47a07f155d978b06b18cdbda6b6912005144ce28
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu May 6 14:05:15 2021 +0200

    tests: Add new ambassador user for frontend tests
    
    This refactor existing permission code to allow creation of user with some permissions.
    
    Related to T3213

commit 11d7c4ef5fedac657953e1e610eb5a7ccab7c9c4
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Wed May 5 15:25:33 2021 +0200

    Add new bundle type to list only when connected as privileged user
    
    This is only doing listing for now. It's in a dedicated commit so review is easier.
    
    Some more work is required ui and server side to actually schedule those new visit type.
    It will be done in a future commit.
    
    Related to T3213

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/800/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/800/console

Build is green

Patch application report for D5696 (id=20404)

Could not rebase; Attempt merge onto fcf53f1ec3...

Updating fcf53f1e..9518d4bb
Fast-forward
 assets/src/bundles/save/index.js            |  41 +++++++--
 assets/src/bundles/save/save.css            |  10 +++
 cypress/integration/origin-save.spec.js     |  79 +++++++++++++++++
 cypress/support/index.js                    |   4 +
 swh/web/api/views/origin_save.py            |  16 ++--
 swh/web/auth/utils.py                       |  11 +++
 swh/web/common/origin_save.py               | 132 +++++++++++++++++++++-------
 swh/web/common/swh_templatetags.py          |   7 +-
 swh/web/common/typing.py                    |   2 +-
 swh/web/misc/origin_save.py                 |   8 +-
 swh/web/templates/misc/origin-save.html     |  21 ++++-
 swh/web/tests/api/test_throttling.py        |  15 +---
 swh/web/tests/api/views/test_origin_save.py |  72 ++++++++++++++-
 swh/web/tests/common/test_origin_save.py    |  61 ++++++++++++-
 swh/web/tests/create_test_users.py          |  23 +++--
 swh/web/tests/misc/test_origin_save.py      |  45 ++++++++--
 swh/web/tests/test_create_users.py          |  16 ++++
 swh/web/tests/utils.py                      |  24 ++++-
 18 files changed, 508 insertions(+), 79 deletions(-)
 create mode 100644 assets/src/bundles/save/save.css
 create mode 100644 swh/web/tests/test_create_users.py
Changes applied before test
commit 9518d4bb911b47eb9efff616147b0d0236d4b160
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Wed May 5 15:41:34 2021 +0200

    Allow privileged user to trigger save code now bundle visit type
    
    Related to T3213

commit 47a07f155d978b06b18cdbda6b6912005144ce28
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu May 6 14:05:15 2021 +0200

    tests: Add new ambassador user for frontend tests
    
    This refactor existing permission code to allow creation of user with some permissions.
    
    Related to T3213

commit 11d7c4ef5fedac657953e1e610eb5a7ccab7c9c4
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Wed May 5 15:25:33 2021 +0200

    Add new bundle type to list only when connected as privileged user
    
    This is only doing listing for now. It's in a dedicated commit so review is easier.
    
    Some more work is required ui and server side to actually schedule those new visit type.
    It will be done in a future commit.
    
    Related to T3213

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

Build is green

Patch application report for D5696 (id=20406)

Could not rebase; Attempt merge onto fcf53f1ec3...

Updating fcf53f1e..47a07f15
Fast-forward
 swh/web/api/views/origin_save.py         |  8 ++---
 swh/web/auth/utils.py                    | 11 +++++++
 swh/web/common/origin_save.py            | 50 ++++++++++++++++++++------------
 swh/web/common/swh_templatetags.py       |  7 +++--
 swh/web/misc/origin_save.py              |  8 +++--
 swh/web/tests/api/test_throttling.py     | 15 +++-------
 swh/web/tests/common/test_origin_save.py | 32 ++++++++++++++++++++
 swh/web/tests/create_test_users.py       | 23 +++++++++++----
 swh/web/tests/misc/test_origin_save.py   | 45 +++++++++++++++++++++++-----
 swh/web/tests/test_create_users.py       | 16 ++++++++++
 swh/web/tests/utils.py                   | 24 ++++++++++++++-
 11 files changed, 186 insertions(+), 53 deletions(-)
 create mode 100644 swh/web/tests/test_create_users.py
Changes applied before test
commit 47a07f155d978b06b18cdbda6b6912005144ce28
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu May 6 14:05:15 2021 +0200

    tests: Add new ambassador user for frontend tests
    
    This refactor existing permission code to allow creation of user with some permissions.
    
    Related to T3213

commit 11d7c4ef5fedac657953e1e610eb5a7ccab7c9c4
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Wed May 5 15:25:33 2021 +0200

    Add new bundle type to list only when connected as privileged user
    
    This is only doing listing for now. It's in a dedicated commit so review is easier.
    
    Some more work is required ui and server side to actually schedule those new visit type.
    It will be done in a future commit.
    
    Related to T3213

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

Build has FAILED

Patch application report for D5696 (id=20437)

Could not rebase; Attempt merge onto 1e97586914...

Updating 1e975869..19452d1b
Fast-forward
 swh/web/api/views/origin_save.py         |  8 ++---
 swh/web/auth/utils.py                    | 11 +++++++
 swh/web/common/origin_save.py            | 50 ++++++++++++++++++++------------
 swh/web/common/swh_templatetags.py       |  7 +++--
 swh/web/misc/origin_save.py              |  8 +++--
 swh/web/tests/api/test_throttling.py     | 15 +++-------
 swh/web/tests/common/test_origin_save.py | 32 ++++++++++++++++++++
 swh/web/tests/create_test_users.py       | 23 +++++++++++----
 swh/web/tests/misc/test_origin_save.py   | 45 +++++++++++++++++++++++-----
 swh/web/tests/test_create_users.py       | 16 ++++++++++
 swh/web/tests/utils.py                   | 24 ++++++++++++++-
 11 files changed, 186 insertions(+), 53 deletions(-)
 create mode 100644 swh/web/tests/test_create_users.py
Changes applied before test
commit 19452d1b88aace058902241b06db925ec1f65afe
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu May 6 14:05:15 2021 +0200

    tests: Add new ambassador user for frontend tests
    
    This refactor existing permission code to allow creation of user with some permissions.
    
    Related to T3213

commit 2a4f2e966a034e034a736e7e10b2b572ef32c89b
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Wed May 5 15:25:33 2021 +0200

    Add new bundle type to list only when connected as privileged user
    
    This is only doing listing for now. It's in a dedicated commit so review is easier.
    
    Some more work is required ui and server side to actually schedule those new visit type.
    It will be done in a future commit.
    
    Related to T3213

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/810/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/810/console

Build is green

Patch application report for D5696 (id=20437)

Could not rebase; Attempt merge onto 1e97586914...

Updating 1e975869..19452d1b
Fast-forward
 swh/web/api/views/origin_save.py         |  8 ++---
 swh/web/auth/utils.py                    | 11 +++++++
 swh/web/common/origin_save.py            | 50 ++++++++++++++++++++------------
 swh/web/common/swh_templatetags.py       |  7 +++--
 swh/web/misc/origin_save.py              |  8 +++--
 swh/web/tests/api/test_throttling.py     | 15 +++-------
 swh/web/tests/common/test_origin_save.py | 32 ++++++++++++++++++++
 swh/web/tests/create_test_users.py       | 23 +++++++++++----
 swh/web/tests/misc/test_origin_save.py   | 45 +++++++++++++++++++++++-----
 swh/web/tests/test_create_users.py       | 16 ++++++++++
 swh/web/tests/utils.py                   | 24 ++++++++++++++-
 11 files changed, 186 insertions(+), 53 deletions(-)
 create mode 100644 swh/web/tests/test_create_users.py
Changes applied before test
commit 19452d1b88aace058902241b06db925ec1f65afe
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu May 6 14:05:15 2021 +0200

    tests: Add new ambassador user for frontend tests
    
    This refactor existing permission code to allow creation of user with some permissions.
    
    Related to T3213

commit 2a4f2e966a034e034a736e7e10b2b572ef32c89b
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Wed May 5 15:25:33 2021 +0200

    Add new bundle type to list only when connected as privileged user
    
    This is only doing listing for now. It's in a dedicated commit so review is easier.
    
    Some more work is required ui and server side to actually schedule those new visit type.
    It will be done in a future commit.
    
    Related to T3213

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

Update the Makefile.local so the users are created also when using the devserver target.

Makefile.local
49

this target should also depend on add-test-users

52

same here

67

same here

Add missing makefile targets

Revert the makefile change (it needs to be in a dedicated commit)

Build is green

Patch application report for D5696 (id=20443)

Could not rebase; Attempt merge onto 1e97586914...

Updating 1e975869..1c8708c1
Fast-forward
 Makefile.local                           | 18 +++++++-----
 swh/web/api/views/origin_save.py         |  8 ++---
 swh/web/auth/utils.py                    | 11 +++++++
 swh/web/common/origin_save.py            | 50 ++++++++++++++++++++------------
 swh/web/common/swh_templatetags.py       |  7 +++--
 swh/web/misc/origin_save.py              |  8 +++--
 swh/web/tests/api/test_throttling.py     | 15 +++-------
 swh/web/tests/common/test_origin_save.py | 32 ++++++++++++++++++++
 swh/web/tests/create_test_users.py       | 23 +++++++++++----
 swh/web/tests/misc/test_origin_save.py   | 45 +++++++++++++++++++++++-----
 swh/web/tests/test_create_users.py       | 16 ++++++++++
 swh/web/tests/utils.py                   | 24 ++++++++++++++-
 12 files changed, 196 insertions(+), 61 deletions(-)
 create mode 100644 swh/web/tests/test_create_users.py
Changes applied before test
commit 1c8708c1fdf393c36ad7179fbd7bc7596b64f6ee
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu May 6 14:05:15 2021 +0200

    tests: Add new ambassador user for frontend tests
    
    This refactor existing permission code to allow creation of user with some permissions.
    
    This reworks the Makefile.local to create the users accordingly in different targets.
    
    Related to T3213

commit 2a4f2e966a034e034a736e7e10b2b572ef32c89b
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Wed May 5 15:25:33 2021 +0200

    Add new bundle type to list only when connected as privileged user
    
    This is only doing listing for now. It's in a dedicated commit so review is easier.
    
    Some more work is required ui and server side to actually schedule those new visit type.
    It will be done in a future commit.
    
    Related to T3213

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

Build is green

Patch application report for D5696 (id=20444)

Could not rebase; Attempt merge onto 1e97586914...

Updating 1e975869..1c8708c1
Fast-forward
 Makefile.local                           | 18 +++++++-----
 swh/web/api/views/origin_save.py         |  8 ++---
 swh/web/auth/utils.py                    | 11 +++++++
 swh/web/common/origin_save.py            | 50 ++++++++++++++++++++------------
 swh/web/common/swh_templatetags.py       |  7 +++--
 swh/web/misc/origin_save.py              |  8 +++--
 swh/web/tests/api/test_throttling.py     | 15 +++-------
 swh/web/tests/common/test_origin_save.py | 32 ++++++++++++++++++++
 swh/web/tests/create_test_users.py       | 23 +++++++++++----
 swh/web/tests/misc/test_origin_save.py   | 45 +++++++++++++++++++++++-----
 swh/web/tests/test_create_users.py       | 16 ++++++++++
 swh/web/tests/utils.py                   | 24 ++++++++++++++-
 12 files changed, 196 insertions(+), 61 deletions(-)
 create mode 100644 swh/web/tests/test_create_users.py
Changes applied before test
commit 1c8708c1fdf393c36ad7179fbd7bc7596b64f6ee
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu May 6 14:05:15 2021 +0200

    tests: Add new ambassador user for frontend tests
    
    This refactor existing permission code to allow creation of user with some permissions.
    
    This reworks the Makefile.local to create the users accordingly in different targets.
    
    Related to T3213

commit 2a4f2e966a034e034a736e7e10b2b572ef32c89b
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Wed May 5 15:25:33 2021 +0200

    Add new bundle type to list only when connected as privileged user
    
    This is only doing listing for now. It's in a dedicated commit so review is easier.
    
    Some more work is required ui and server side to actually schedule those new visit type.
    It will be done in a future commit.
    
    Related to T3213

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

Revert the makefile modification (it needs a dedicated commit)

Build is green

Patch application report for D5696 (id=20450)

Could not rebase; Attempt merge onto 1e97586914...

Updating 1e975869..ee8ece2e
Fast-forward
 swh/web/api/views/origin_save.py         |  8 ++---
 swh/web/auth/utils.py                    | 11 +++++++
 swh/web/common/origin_save.py            | 50 ++++++++++++++++++++------------
 swh/web/common/swh_templatetags.py       |  7 +++--
 swh/web/misc/origin_save.py              |  8 +++--
 swh/web/tests/api/test_throttling.py     | 15 +++-------
 swh/web/tests/common/test_origin_save.py | 32 ++++++++++++++++++++
 swh/web/tests/create_test_users.py       | 23 +++++++++++----
 swh/web/tests/misc/test_origin_save.py   | 45 +++++++++++++++++++++++-----
 swh/web/tests/test_create_users.py       | 16 ++++++++++
 swh/web/tests/utils.py                   | 24 ++++++++++++++-
 11 files changed, 186 insertions(+), 53 deletions(-)
 create mode 100644 swh/web/tests/test_create_users.py
Changes applied before test
commit ee8ece2e6b2c2820a2ee493f9f7f7ff987eaa6f4
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu May 6 14:05:15 2021 +0200

    tests: Add new ambassador user for frontend tests
    
    This refactor existing permission code to allow creation of user with some permissions.
    
    This reworks the Makefile.local to create the users accordingly in different targets.
    
    Related to T3213

commit 2a4f2e966a034e034a736e7e10b2b572ef32c89b
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Wed May 5 15:25:33 2021 +0200

    Add new bundle type to list only when connected as privileged user
    
    This is only doing listing for now. It's in a dedicated commit so review is easier.
    
    Some more work is required ui and server side to actually schedule those new visit type.
    It will be done in a future commit.
    
    Related to T3213

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