<commit_before>import uuid

from django.test import TestCase
from django.urls import reverse

from casexml.apps.case.mock import CaseBlock

from corehq import privileges
from corehq.apps.domain.shortcuts import create_domain
from corehq.apps.users.models import Permissions, UserRole, WebUser
from corehq.form_processor.interfaces.dbaccessors import (
    CaseAccessors,
    FormAccessors,
)
from corehq.form_processor.tests.utils import (
    FormProcessorTestUtils,
    use_sql_backend,
)
from corehq.util.test_utils import flag_enabled, privilege_enabled

from ..utils import submit_case_blocks


@use_sql_backend
@privilege_enabled(privileges.API_ACCESS)
@flag_enabled('CASE_API_V0_6')
class TestCaseAPI(TestCase):
    domain = 'test-update-cases'
    maxDiff = None

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
        cls.domain_obj = create_domain(cls.domain)
        role = UserRole.create(
            cls.domain, 'edit-data', permissions=Permissions(edit_data=True)
        )
        cls.web_user = WebUser.create(cls.domain, 'netflix', 'password', None, None, role_id=role.get_id)
        cls.case_accessor = CaseAccessors(cls.domain)
        cls.form_accessor = FormAccessors(cls.domain)

    def setUp(self):<commit_msg>use sql role in case update api tests<commit_after>import uuid

from django.test import TestCase
from django.urls import reverse

from casexml.apps.case.mock import CaseBlock

from corehq import privileges
from corehq.apps.domain.shortcuts import create_domain
from corehq.apps.users.models import Permissions, SQLUserRole, WebUser
from corehq.form_processor.interfaces.dbaccessors import (
    CaseAccessors,
    FormAccessors,
)
from corehq.form_processor.tests.utils import (
    FormProcessorTestUtils,
    use_sql_backend,
)
from corehq.util.test_utils import flag_enabled, privilege_enabled

from ..utils import submit_case_blocks


@use_sql_backend
@privilege_enabled(privileges.API_ACCESS)
@flag_enabled('CASE_API_V0_6')
class TestCaseAPI(TestCase):
    domain = 'test-update-cases'
    maxDiff = None

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
        cls.domain_obj = create_domain(cls.domain)
        role = SQLUserRole.create(
            cls.domain, 'edit-data', permissions=Permissions(edit_data=True)
        )
        cls.web_user = WebUser.create(cls.domain, 'netflix', 'password', None, None, role_id=role.get_id)
        cls.case_accessor = CaseAccessors(cls.domain)
        cls.form_accessor = FormAccessors(cls.domain)

    def setUp(self):
{'fraction_non_alphanumeric': 0.08784313725490196, 'fraction_numerical': 0.001568627450980392, 'mean_word_length': 4.206122448979592, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '5621480', 'n_tokens_mistral': 806, 'n_tokens_neox': 801, 'n_words': 166}