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

Only active projects appear on member permissions page #789

Merged
merged 1 commit into from
Oct 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cadasta/organization/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ def __init__(self, data, org, user, current_user, *args, **kwargs):
project__organization=org).values('project__id', 'role')
project_roles = {r['project__id']: r['role'] for r in project_roles}

for p in self.organization.projects.values_list('id', 'name'):
active_projects = self.organization.projects.filter(archived=False)
for p in active_projects.values_list('id', 'name'):
role = project_roles.get(p[0], 'Pb')

self.fields[p[0]] = forms.ChoiceField(
Expand Down
4 changes: 3 additions & 1 deletion functional_tests/organizations/test_organization_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,11 @@ def test_changing_member_project_permissions(self):
OrganizationMemberListPage(self).go_to_member_list_page()
page.go_to_testuser_member_page()

first_project = page.get_project_title_in_table()
assert first_project == 'Test Project'
options = page.get_permission_options()
assert options['selected'].text == options['pb'].text
options["pm"].click()
options['pm'].click()

page.click_submit_button()
page.go_to_testuser_member_page()
Expand Down
7 changes: 7 additions & 0 deletions functional_tests/pages/OrganizationMember.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ def try_cancel_and_close(self):
self.click_remove_button
)

def get_table_data(self, xpath, row):
return self.test.table_body(
"projects-permissions", "//tr{}//td".format(row) + xpath)

def get_project_title_in_table(self, row="[1]"):
return self.get_table_data("//label", row).text

def get_project_permission(self, xpath):
return self.test.table_body("projects-permissions", '//select' + xpath)

Expand Down