ail-framework/tests/testKeys.py

37 lines
887 B
Python
Raw Normal View History

2018-05-04 12:25:47 +00:00
#!/usr/bin/env python3
2018-04-11 08:14:33 +00:00
# -*- coding: utf-8 -*-
2018-04-26 14:54:42 +00:00
import sys,os
2018-04-11 08:14:33 +00:00
import unittest
import magic
2018-04-26 14:54:42 +00:00
sys.path.append(os.environ['AIL_BIN'])
from packages.Paste import Paste
import Keys as Keys
from Helper import Process
2018-05-04 12:25:47 +00:00
from pubsublogger import publisher
2018-04-11 08:14:33 +00:00
class TestKeysModule(unittest.TestCase):
def setUp(self):
2018-04-26 14:54:42 +00:00
self.paste = Paste('../samples/2018/01/01/keys_certificat_sample.gz')
2018-04-11 08:14:33 +00:00
# Section name in bin/packages/modules.cfg
self.config_section = 'Keys'
# Setup the I/O queues
p = Process(self.config_section)
def test_search_key(self):
with self.assertRaises(pubsublogger.exceptions.NoChannelError):
Keys.search_key(self.paste)
2018-05-04 12:25:47 +00:00
def test_search_key(self):
with self.assertRaises(NameError):
publisher.port = 6380
publisher.channel = 'Script'
Keys.search_key(self.paste)