test_commands.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:ndr 作者: SecuredByTHEM 项目源码 文件源码
def test_alert_tester(self):
        '''Tests alert tester messages'''
        alert_tester_cli = ["alert_tester", "-c", self._ndr_config_file]
        with unittest.mock.patch.object(sys, 'argv', alert_tester_cli):
            ndr.tools.alert_tester.main()

        # Make sure there's only one file in the queue
        outbound_queue = os.listdir(self._ncc.outgoing_upload_spool)
        self.assertEqual(len(outbound_queue), 1)
        this_msg = self._ncc.outgoing_upload_spool + "/" + outbound_queue[0]

        loaded_msg = ndr.IngestMessage.verify_and_load_message(
            self._ncc, this_msg, only_accept_cn="ndr_test_suite")
        os.remove(this_msg)

        self.assertEqual(loaded_msg.message_type, ndr.IngestMessageTypes.TEST_ALERT)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号