<commit_before>#!/usr/bin/env python

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from dino.db.manager.rooms import RoomManager
from dino.exceptions import NoSuchChannelException
from dino.exceptions import NoSuchRoomException

from uuid import uuid4 as uuid
from test.db import BaseDatabaseTest

__author__ = '<NAME> <<EMAIL>>'


class RoomManagerTest(BaseDatabaseTest):
    _act = None

    @staticmethod
    def _publish(activity: dict) -> None:
        RoomManagerTest._act = activity

    def setUp(self):
        self.set_up_env('redis')
        self.env.publish = RoomManagerTest._publish
        self._act = None
        self.env.db = self.db
        self.manager = RoomManager(self.env)

    def tearDown(self):
        self.db.redis.flushall()
        self.env.cache._flushall()

    def test_get_rooms_before_channel_creation(self):
        rooms = self.manager.get_rooms(BaseDatabaseTest.CHANNEL_ID)
        self.assertEqual(0, len(rooms))<commit_msg>fixed test cases<commit_after>#!/usr/bin/env python

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from dino.db.manager.rooms import RoomManager
from dino.exceptions import NoSuchChannelException
from dino.exceptions import NoSuchRoomException

from uuid import uuid4 as uuid
from test.db import BaseDatabaseTest

__author__ = '<NAME> <<EMAIL>>'


class RoomManagerTest(BaseDatabaseTest):
    _act = None

    @staticmethod
    def _publish(activity: dict, external: bool=False) -> None:
        RoomManagerTest._act = activity

    def setUp(self):
        self.set_up_env('redis')
        self.env.publish = RoomManagerTest._publish
        self._act = None
        self.env.db = self.db
        self.manager = RoomManager(self.env)

    def tearDown(self):
        self.db.redis.flushall()
        self.env.cache._flushall()

    def test_get_rooms_before_channel_creation(self):
        rooms = self.manager.get_rooms(BaseDatabaseTest.CHANNEL_ID)
        self.assertEqual(0, len(rooms))
{'fraction_non_alphanumeric': 0.08387096774193549, 'fraction_numerical': 0.0040747028862478775, 'mean_word_length': 3.6687797147385104, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3685596', 'n_tokens_mistral': 833, 'n_tokens_neox': 822, 'n_words': 277}