<commit_before>import synapse.tests.utils as s_t_utils

import synapse.tools.cellauth as s_cellauth

class CellAuthTest(s_t_utils.SynTest):

    async def test_cellauth_bad(self):

        async with self.getTestCore() as core:

            coreurl = core.getLocalUrl()

            argv = [coreurl]
            outp = self.getTestOutp()
            self.eq(await s_cellauth.main(argv, outp), -1)
            outp.expect('the following arguments are required:')

            outp.clear()
            argv = [coreurl, 'modify', '--adduser', 'foo', '--object', 'foo:bar']
            await s_cellauth.main(argv, outp)
            outp.expect('only valid with --addrule')

    async def test_cellauth_list(self):<commit_msg>test cellauth with bad version (#1593)<commit_after>import unittest.mock as mock

import synapse.tests.utils as s_t_utils

import synapse.tools.cellauth as s_cellauth

class CellAuthTest(s_t_utils.SynTest):

    async def test_cellauth_bad(self):

        async with self.getTestCore() as core:

            coreurl = core.getLocalUrl()

            argv = [coreurl]
            outp = self.getTestOutp()
            self.eq(await s_cellauth.main(argv, outp), -1)
            outp.expect('the following arguments are required:')

            outp.clear()
            argv = [coreurl, 'modify', '--adduser', 'foo', '--object', 'foo:bar']
            await s_cellauth.main(argv, outp)
            outp.expect('only valid with --addrule')

            def fakevers(self):
                return (0, 0, 0)

            with mock.patch('synapse.telepath.Proxy._getSynVers', fakevers):
                argv = [coreurl, 'modify', '--adduser', 'foo']
                outp = self.getTestOutp()
                await s_cellauth.main(argv, outp)
                outp.expect('Cell version 0.0.0 is outside of the cellauth supported range')

                argv = [coreurl, 'list']
                outp = self.getTestOutp()
                await s_cellauth.main(argv, outp)
                outp.expect('Cell version 0.0.0 is outside of the cellauth supported range')

    async def test_cellauth_list(self):
{'fraction_non_alphanumeric': 0.11294896030245746, 'fraction_numerical': 0.007088846880907372, 'mean_word_length': 2.1882530120481927, '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': '1065078', 'n_tokens_mistral': 670, 'n_tokens_neox': 640, 'n_words': 157}