Merge lp:~nealpzhang/juju-ci-tools/assess_multi_users into lp:juju-ci-tools
| Status: | Merged |
|---|---|
| Merge reported by: | Leo Zhang |
| Merged at revision: | not available |
| Proposed branch: | lp:~nealpzhang/juju-ci-tools/assess_multi_users |
| Merge into: | lp:juju-ci-tools |
| Diff against target: |
958 lines (+529/-198) 7 files modified
assess_container_networking.py (+1/-1) assess_unregister.py (+1/-2) assess_user_grant_revoke.py (+264/-91) jujupy.py (+61/-2) tests/test_assess_unregister.py (+7/-6) tests/test_assess_user_grant_revoke.py (+85/-93) tests/test_jujupy.py (+110/-3) |
| To merge this branch: | bzr merge lp:~nealpzhang/juju-ci-tools/assess_multi_users |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Nicholas Skaggs | Approve on 2016-07-27 | ||
| Aaron Bentley (community) | 2016-07-07 | Approve on 2016-07-25 | |
|
Review via email:
|
|||
Commit Message
Added multi-users' tests
Description of the Change
Added tests for multi-users.
| Aaron Bentley (abentley) wrote : | # |
This is improved, but there are still some issues, as noted below.
| Nicholas Skaggs (nskaggs) wrote : | # |
Again some more comments.
| Nicholas Skaggs (nskaggs) wrote : | # |
More comments. A minor quibble, but I would like to see your assess_* functions be named assert_*. The only assess_* function should be the primary test function in following with project naming.
Also, try to format your code in paragraphs. Feel free to use spacing to logically group statements together. Currently the compressed nature of the code makes it harder to read.
Finally, it would be nice to better frame your assert functions so conditionals are not required. Instead clear expectations of what a user should and should not be able to do (based purely upon there permission levels), which you should pass in. You should run the asserts for all users -- even those who you expect to not be able to perform an action.
| Leo Zhang (nealpzhang) wrote : | # |
Aaron, Nicholas:
New updates after review.
Thanks
| Aaron Bentley (abentley) wrote : | # |
In general, it is confusing to provide "assertion" as a variable name. Assertions are statements, not boolean variables. I think "has_permission" would work as a variable name everywhere you've used "assertion".
Please be clear about whether you're testing model or controller permissions. assert_read is really assert_read_model, assert_write is really assert_write_model, and assert_admin is really assert_
Please use narrow try/except blocks. Don't include anything in the try block unless you expect it to raise the exception. So for example:
code = ''.join(
try:
except subprocess.
You don't expect random.choice or xrange to raise CalledProcessError, so don't put them in the try block. If they do raise CalledProcessError, something very strange is happening and your test should fail with a traceback.
There's some wiggle room. It would be annoying to have separate try/except blocks for each child.expect() in case it raised pexpect.TIMEOUT, so putting a series of expect/sendline calls together in a single try/except block is fine. But I don't think child.isalive can raise pexpect.TIMEOUT, so it should go outside the try/except block.
It would be nice to check stderr to make sure that it is really a permissions error.
| Leo Zhang (nealpzhang) wrote : | # |
Aaron/Nicholas,
New updates after review.
Thanks
| Aaron Bentley (abentley) wrote : | # |
Some style changes to fix, but otherwise, I think this is landable.
| Nicholas Skaggs (nskaggs) wrote : | # |
A couple final comments. Please address them, but you have my approval. I don't need to re-review before merging. Thanks for working on this!
I'll note remove user is landing, and this test should be updated to support it as well (but not i this MP).

See comments inline.
The big thing is you can't store the user name on the backing state, because the backing state should be shared by all clients.