Skip to content

Commit

Permalink
Fix permission issue for intiators project create
Browse files Browse the repository at this point in the history
  • Loading branch information
slomo committed Oct 11, 2016
1 parent 83820a1 commit d89258f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions euth/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ class DashboardBlueprintListView(DashboardBaseMixin,
blueprints = blueprints.blueprints
permission_required = 'euth_organisations.initiate_project'

def get_permission_object(self):
return self.organisation


class DashboardProjectCreateView(DashboardBaseMixin,
rules_views.PermissionRequiredMixin,
Expand Down
16 changes: 16 additions & 0 deletions tests/dashboard/test_dashboard_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,19 @@ def test_dashboard_update_organisation(client, organisation):

with switch_language(organisation, 'de'):
assert organisation.description == 'desc.de'


@pytest.mark.django_db
def test_dashboard_blueprint(client, organisation):
from euth.dashboard.blueprints import blueprints
url = reverse('dashboard-blueprint-list', kwargs={
'organisation_slug': organisation.slug
})
user = organisation.initiators.first()
response = client.get(url)
assert response.status_code == 302
assert redirect_target(response) == 'account_login'
client.login(username=user.email, password='password')
response = client.get(url)
assert response.status_code == 200
assert response.context_data['view'].blueprints == blueprints

0 comments on commit d89258f

Please sign in to comment.