@@ -98,51 +98,6 @@ def test_runtime_syntax(self):
9898 interpreted = json .loads (fcontent )
9999 self .assertEqual (to_json (interpreted ), fcontent )
100100
101- def test_bots (self ):
102- """ Test if BOTS has correct syntax and consistent content. """
103- with open (pkg_resources .resource_filename ('intelmq' ,
104- 'bots/BOTS' )) as fhandle :
105- fcontent = fhandle .read ()
106-
107- interpreted = json .loads (fcontent ,
108- object_pairs_hook = collections .OrderedDict )
109- self .assertEqual (to_unsorted_json (interpreted ), fcontent )
110-
111- for groupname , group in interpreted .items ():
112- for bot_name , bot_config in group .items ():
113- for field in ['description' , 'module' , 'parameters' ]:
114- self .assertIn (field , bot_config )
115- importlib .import_module (bot_config ['module' ])
116-
117- def test_modules_in_bots (self ):
118- """ Test if all bot modules are mentioned BOTS file. """
119- with open (pkg_resources .resource_filename ('intelmq' ,
120- 'bots/BOTS' )) as fhandle :
121- fcontent = fhandle .read ()
122-
123- interpreted = json .loads (fcontent ,
124- object_pairs_hook = collections .OrderedDict )
125- modules = set ()
126-
127- for groupname , group in interpreted .items ():
128- for bot_name , bot_config in group .items ():
129- modules .add (bot_config ['module' ])
130-
131- for _ , groupname , _ in pkgutil .iter_modules (path = intelmq .bots .__path__ ):
132- group = importlib .import_module ('intelmq.bots.%s' % groupname )
133- for _ , providername , _ in pkgutil .iter_modules (path = group .__path__ ):
134- modulename = 'intelmq.bots.%s.%s' % (groupname , providername )
135- provider = importlib .import_module (modulename )
136- for _ , botname , _ in pkgutil .iter_modules (path = provider .__path__ ):
137- classname = 'intelmq.bots.%s.%s.%s' % (groupname , providername , botname )
138- self .assertFalse (classname not in modules and '_' in botname ,
139- msg = "Bot %r not found in BOTS file." % classname )
140-
141- for module in modules :
142- bot = importlib .import_module (module )
143- self .assertTrue (hasattr (bot , 'BOT' ),
144- msg = 'Module %r has no variable BOT.' % module )
145-
146101
147102class CerberusTests (unittest .TestCase ):
148103
0 commit comments