<commit_before>#!/usr/bin/env python
# encoding: utf-8

"""
Tests for the permissions system
"""

import os
os.environ['FLASK_CONF'] = 'TEST'
import unittest
from test_permissions import PermissionsUnitTest

from ddt import ddt, data

PTest = PermissionsUnitTest.PTest
PERMISSIONS_TESTS = [
    PTest("student_get_assignment",
          "student0", "Assignment", "first", "get", True),
    PTest("anon_get_assignment",
          "anon", "Assignment", "first", "get", True),
    PTest("student_create_assignment",
          "student0", "Assignment", "first", "create", False),
    PTest("admin_create_assignment",
          "admin", "Assignment", "first", "create", True),
    PTest("anon_create_assignment",
          "anon", "Assignment", "first", "create", False),
    PTest("admin_delete_normal",
          "admin", "Assignment", "first", "delete", False),
    PTest("staff_delete_normal",
          "staff", "Assignment", "first", "delete", False),
    PTest("admin_delete_empty",
          "admin", "Assignment", "empty", "delete", False),
    PTest("staff_delete_empty",
          "staff", "Assignment", "empty", "delete", False),
    PTest("staff_delete_empty",
          "empty_staff", "Assignment", "empty", "delete", False),
]

#pylint: disable=no-init, missing-docstring
@ddt
class AssignmentPermissionsUnitTest(PermissionsUnitTest):
    @data(*PERMISSIONS_TESTS) #pylint: disable=star-args
    def test_access(self, value):
        return PermissionsUnitTest.access(self, value)

if __name__ == "__main__":
    unittest.main()<commit_msg>add permissions tests to assiginment editing<commit_after>#!/usr/bin/env python
# encoding: utf-8

"""
Tests for the permissions system
"""

import os
os.environ['FLASK_CONF'] = 'TEST'
import unittest
from test_permissions import PermissionsUnitTest

from ddt import ddt, data

PTest = PermissionsUnitTest.PTest
PERMISSIONS_TESTS = [
    PTest("student_get_assignment",
          "student0", "Assignment", "first", "get", True),
    PTest("anon_get_assignment",
          "anon", "Assignment", "first", "get", True),
    PTest("student_create_assignment",
          "student0", "Assignment", "first", "create", False),
    PTest("admin_create_assignment",
          "admin", "Assignment", "first", "create", True),
    PTest("anon_create_assignment",
          "anon", "Assignment", "first", "create", False),
    PTest("anon_edit_assignment",
          "anon", "Assignment", "first", "put", False),
    PTest("staff_edit_assignment",
          "staff", "Assignment", "first", "put", True),
    PTest("admin_edit_assignment",
          "admin", "Assignment", "first", "put", True),
    PTest("admin_delete_normal",
          "admin", "Assignment", "first", "delete", False),
    PTest("staff_delete_normal",
          "staff", "Assignment", "first", "delete", False),
    PTest("admin_delete_empty",
          "admin", "Assignment", "empty", "delete", False),
    PTest("staff_delete_empty",
          "staff", "Assignment", "empty", "delete", False),
    PTest("staff_delete_empty",
          "empty_staff", "Assignment", "empty", "delete", False),
]

#pylint: disable=no-init, missing-docstring
@ddt
class AssignmentPermissionsUnitTest(PermissionsUnitTest):
    @data(*PERMISSIONS_TESTS) #pylint: disable=star-args
    def test_access(self, value):
        return PermissionsUnitTest.access(self, value)

if __name__ == "__main__":
    unittest.main()
{'fraction_non_alphanumeric': 0.15985894798707023, 'fraction_numerical': 0.001763150161622098, 'mean_word_length': 4.253086419753086, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6070347', 'n_tokens_mistral': 1048, 'n_tokens_neox': 1076, 'n_words': 234}