<commit_before>'''
Created on Mar 8, 2013

@author: Gary
'''
import unittest
from outputs.zigbee.zigbeecontrol import ZigBeeControl
from outputs.zigbee.zigbeeoutputstep import ZigBeeOutputStep
from outputs.zigbee.zigbeeoutputthread import ZigBeeOutputThread
from lib.hmqueue import HMQueue
from lib.constants import Constants
from mock import Mock, MagicMock, patch
from lib.common import Common
import logging.config


class Test(unittest.TestCase):

    logger = logging.getLogger('UnitTest')

    def setUp(self):
        logging.config.fileConfig("house_monitor_logging.conf")

    def tearDown(self):
        pass

    def test_logger_name(self):
        zig = ZigBeeControl()
        self.assertEqual(Constants.LogKeys.outputsZigBee, zig.logger_name)

    @patch('outputs.zigbee.zigbeecontrol.HMQueue', spec=HMQueue)
    @patch('outputs.zigbee.zigbeecontrol.ZigBeeOutputThread', spec=ZigBeeOutputThread)
    @patch('outputs.zigbee.zigbeecontrol.ZigBeeOutputStep', spec=ZigBeeOutputStep)
    def test_start_zigbee(self, step, thread, queue):
        # setup
        options = 1
        cont = ZigBeeControl()
        queue.return_value = 1

        # run
        cont.startZigBee(options)

        # test
        queue.assert_called_with()
        thread.assert_called_with(1)
        step.assert_called_with(1)

if __name__ == "__main__":
    # import sys;sys.argv = ['', 'Test.testName']
    unittest.main()<commit_msg>OPEN - task 31: Move scheduled event Pulse from HMSchedule to status_panel and uptime.  http://github.com/gary-pickens/HouseMonitor/issues/issue/31<commit_after>'''
Created on Mar 8, 2013

@author: Gary
'''
import unittest
from outputs.zigbee.zigbeecontrol import ZigBeeControl
from outputs.zigbee.zigbeeoutputstep import ZigBeeOutputStep
from outputs.zigbee.zigbeeoutputthread import ZigBeeOutputThread
from lib.hmqueue import HMQueue
from lib.constants import Constants
from mock import Mock, MagicMock, patch
from lib.common import Common
import logging.config


class Test( unittest.TestCase ):

    logger = logging.getLogger( 'UnitTest' )

    def setUp( self ):
        logging.config.fileConfig( "house_monitor_logging.conf" )

    def tearDown( self ):
        pass

    def test_logger_name( self ):
        zig = ZigBeeControl()
        self.assertEqual( Constants.LogKeys.outputsZigBee, zig.logger_name )

    @patch( 'outputs.zigbee.zigbeecontrol.HMQueue', spec=HMQueue )
    @patch( 'outputs.zigbee.zigbeecontrol.ZigBeeOutputThread', spec=ZigBeeOutputThread )
    @patch( 'outputs.zigbee.zigbeecontrol.ZigBeeOutputStep', spec=ZigBeeOutputStep )
    def test_start_zigbee( self, step, thread, queue ):
        # setup
        options = 1
        cont = ZigBeeControl()
        queue.return_value = 1

        # run
        cont.startZigBee( options )

        # test
        queue.assert_called_with( 'ZigBeeInput' )
        thread.assert_called_with( 1 )
        step.assert_called_with( 1 )

if __name__ == "__main__":
    # import sys;sys.argv = ['', 'Test.testName']
    unittest.main()
{'fraction_non_alphanumeric': 0.09541102674149884, 'fraction_numerical': 0.007263123142951469, 'mean_word_length': 3.6118721461187215, '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': '4230459', 'n_tokens_mistral': 985, 'n_tokens_neox': 940, 'n_words': 205}