-
Notifications
You must be signed in to change notification settings - Fork 985
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add 'manage' permission * Always store principals as strings Before, these were always UUID objects, but since #1329 this is stored as a string for session-based authentication only. To keep everything consistent, always use strings over UUID objects. * Split profile and project management This gives the logged in user a place to manage their profile, and a place to manage their projects. Mostly stubbed out for now. * Put the gravatar link on the 'Manage Profile' page This no longer needs to be a client-side include because we can just edit it via profile management when the user is logged in. * Some really rudimentary styling, please revert * Role management Adding and deleting roles * Update logged in information architecture, begin styling * Make collaborator form more simple * Allow stacking flash messages * Reuse dropdown SCSS * Style releases table * Update management UI based on meeting feedback * Fix linter errors * Hide 'duplicate' roles * Break management forms into mixins * Simplify delete view * Add ability to change existing roles * Add JournalEntries when adding/removing roles * Add labels for screen readers * Add delete modals, tabs, clean up UI * Put TODOs in comments * Namespace manage routes * Hide draft UIs in templates * Properly comment out Edit Project link * Change 'Preview' to 'View' This will always link to a project/release that is live, so it's never really a "Preview" per se. Also, this allows us to actually have a "Preview" some day when we allow for staged releases. * Fix more linting errors
- Loading branch information
Showing
47 changed files
with
2,025 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import pretend | ||
import pytest | ||
import wtforms | ||
|
||
from webob.multidict import MultiDict | ||
|
||
from warehouse.manage import forms | ||
|
||
|
||
class TestCreateRoleForm: | ||
|
||
def test_creation(self): | ||
user_service = pretend.stub() | ||
form = forms.CreateRoleForm(user_service=user_service) | ||
|
||
assert form.user_service is user_service | ||
|
||
def test_validate_username_with_no_user(self): | ||
user_service = pretend.stub( | ||
find_userid=pretend.call_recorder(lambda userid: None), | ||
) | ||
form = forms.CreateRoleForm(user_service=user_service) | ||
field = pretend.stub(data="my_username") | ||
|
||
with pytest.raises(wtforms.validators.ValidationError): | ||
form.validate_username(field) | ||
|
||
assert user_service.find_userid.calls == [pretend.call("my_username")] | ||
|
||
def test_validate_username_with_user(self): | ||
user_service = pretend.stub( | ||
find_userid=pretend.call_recorder(lambda userid: 1), | ||
) | ||
form = forms.CreateRoleForm(user_service=user_service) | ||
field = pretend.stub(data="my_username") | ||
|
||
form.validate_username(field) | ||
|
||
assert user_service.find_userid.calls == [pretend.call("my_username")] | ||
|
||
@pytest.mark.parametrize(("value", "expected"), [ | ||
("", "Must select a role"), | ||
("invalid", "Not a valid choice"), | ||
(None, "Not a valid choice"), | ||
]) | ||
def test_validate_role_name_fails(self, value, expected): | ||
user_service = pretend.stub( | ||
find_userid=pretend.call_recorder(lambda userid: 1), | ||
) | ||
form = forms.CreateRoleForm( | ||
MultiDict({ | ||
'role_name': value, | ||
'username': 'valid_username', | ||
}), | ||
user_service=user_service, | ||
) | ||
|
||
assert not form.validate() | ||
assert form.role_name.errors == [expected] |
Oops, something went wrong.