Unit test added.

This commit is contained in:
Aaron Tan 2016-10-03 17:32:43 -04:00
parent 764ed8d576
commit 2be5d2f23f
2 changed files with 7 additions and 1 deletions

View File

@ -240,3 +240,10 @@ def test_job_template_creator_access(project, rando, post):
jt_obj = JobTemplate.objects.get(pk=jt_pk)
# Creating a JT should place the creator in the admin role
assert rando in jt_obj.admin_role
@pytest.mark.django_db
def test_associate_label(label, user, job_template):
access = JobTemplateAccess(user('joe', False))
job_template.admin_role.members.add(user('joe', False))
label.organization.read_role.members.add(user('joe', False))
assert access.can_attach(job_template, label, 'labels', None)

View File

@ -61,4 +61,3 @@ def test_label_access_user(label, user):
assert access.can_read(label)
assert access.can_add({'organization': label.organization.id})