<commit_before>from __future__ import absolute_import
from __future__ import unicode_literals

from mock import patch

from corehq.apps.linked_domain.tests.test_linked_apps import BaseLinkedAppsTest
from corehq.apps.linked_domain.updates import update_user_roles
from corehq.apps.userreports.util import get_ucr_class_name
from corehq.apps.users.models import UserRole, Permissions


class TestUpdateRoles(BaseLinkedAppsTest):
    @classmethod
    def setUpClass(cls):
        super(TestUpdateRoles, cls).setUpClass()
        cls.linked_app.master = cls.plain_master_app.get_id
        cls.linked_app.save()

        cls.role = UserRole(
            domain=cls.domain,
            name='test',
            permissions=Permissions(
                edit_data=True,
                view_web_apps_list=[
                    cls.plain_master_app.get_id
                ],
                view_report_list=[
                    'corehq.reports.DynamicReportmaster_report_id'
                ]
            )
        )
        cls.role.save()

    @classmethod
    def tearDownClass(cls):
        cls.role.delete()
        super(TestUpdateRoles, cls).tearDownClass()

    def tearDown(self):
        for role in UserRole.by_domain(self.linked_domain):
            role.delete()
        super(TestUpdateRoles, self).tearDown()

    def test_update_web_apps_list(self, mock):
        self.assertEqual([], UserRole.by_domain(self.linked_domain))<commit_msg>fix test args<commit_after>from __future__ import absolute_import
from __future__ import unicode_literals

from mock import patch

from corehq.apps.linked_domain.tests.test_linked_apps import BaseLinkedAppsTest
from corehq.apps.linked_domain.updates import update_user_roles
from corehq.apps.userreports.util import get_ucr_class_name
from corehq.apps.users.models import UserRole, Permissions


class TestUpdateRoles(BaseLinkedAppsTest):
    @classmethod
    def setUpClass(cls):
        super(TestUpdateRoles, cls).setUpClass()
        cls.linked_app.master = cls.plain_master_app.get_id
        cls.linked_app.save()

        cls.role = UserRole(
            domain=cls.domain,
            name='test',
            permissions=Permissions(
                edit_data=True,
                view_web_apps_list=[
                    cls.plain_master_app.get_id
                ],
                view_report_list=[
                    'corehq.reports.DynamicReportmaster_report_id'
                ]
            )
        )
        cls.role.save()

    @classmethod
    def tearDownClass(cls):
        cls.role.delete()
        super(TestUpdateRoles, cls).tearDownClass()

    def tearDown(self):
        for role in UserRole.by_domain(self.linked_domain):
            role.delete()
        super(TestUpdateRoles, self).tearDown()

    def test_update_web_apps_list(self):
        self.assertEqual([], UserRole.by_domain(self.linked_domain))
{'fraction_non_alphanumeric': 0.08073458073458073, 'fraction_numerical': 0.0, 'mean_word_length': 2.486714975845411, 'pattern_counts': {'":': 0, '<': 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': '7054155', 'n_tokens_mistral': 867, 'n_tokens_neox': 846, 'n_words': 140}