Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow bots check() method to run from test without full initialization #1505

Closed
bernhardreiter opened this issue Feb 18, 2020 · 4 comments
Closed
Labels
component: tests feature Indicates new feature requests or new features
Milestone

Comments

@bernhardreiter
Copy link
Contributor

bernhardreiter commented Feb 18, 2020

Allow the check() methods of bots to run in automatic tests.

Right now the check() can happen without all full libraries imported, to check for the existence of parameters, e.g. in

def check(parameters):

It can be good to use the code for automatic tests as well. For this the prepare_bot() method
of

def prepare_bot(self, parameters={}, destination_queues=None):
would need to be split up, so that the init() method of the bot to be tested is not called. At least this would be needed if check() is used like it is in the MISP Output bot above.

@bernhardreiter bernhardreiter changed the title check allow bots check() method to run from test without full initialization Feb 18, 2020
@ghost ghost added component: tests feature Indicates new feature requests or new features labels Feb 24, 2020
@ghost ghost added this to the 2.2.0 milestone Feb 24, 2020
ghost pushed a commit that referenced this issue Mar 18, 2020
@ghost
Copy link

ghost commented Mar 18, 2020

You mean like this?
8543735

@bernhardreiter
Copy link
Contributor Author

bernhardreiter commented Mar 18, 2020

Thanks for suggestion and improvement. Right now I cannot test it, so maybe. ;) It looks a bit too simple, when I remember what I had tried, but maybe I did not understand enough when trying to poke around.

@ghost
Copy link

ghost commented Mar 18, 2020

It looks a bit too simple,

That's what I thought too :) However, the static check methods are called.

@ghost ghost modified the milestones: 2.2.0, 2.3.0 Jun 17, 2020
@ghost ghost self-assigned this Jan 7, 2021
@ghost ghost closed this as completed in e37a56f Jan 7, 2021
@ghost
Copy link

ghost commented Jan 7, 2021

Based on what I coded in spring last year, I further added tests on the check's return values.

With the upcoming changes in the configuration handling, the check method will gain more functionalities.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tests feature Indicates new feature requests or new features
Projects
None yet
Development

No branches or pull requests

1 participant