Skip to content

Commit

Permalink
Ensure the agent can access non-pub projects
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricky Cook committed Jul 13, 2016
1 parent 73175e4 commit 1470c82
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/db/test_public_projects_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,35 @@ def test_user(self,
})

assert response.status_code == 200

@pytest.mark.usefixtures('stages')
@pytest.mark.parametrize('url_fs', [
'/projects/{project_slug}',
'/projects/{project_slug}/jobs/{job_slug}',
'/projects/{project_slug}/jobs/{job_slug}/stages/{stage_slug}',
])
@pytest.mark.parametrize('project_slug', [
'pp-pub1', 'pp-pri1', 'pp-pub2', 'pp-pri2',
])
def test_agent(self,
client,
jobs,
agent_token,
url_fs,
project_slug,
):
""" Ensure all projects accessible as user """
project = Project.query.filter_by(slug=project_slug)[0]
job = project.jobs[0]
stage = job.job_stages[0]

full_url = ('/api/v1%s' % url_fs).format(
project_slug=project.slug,
job_slug=job.slug,
stage_slug=stage.slug,
)
response = client.get(full_url, headers={
'x_dockci_api_key': agent_token,
})

assert response.status_code == 200

0 comments on commit 1470c82

Please sign in to comment.