tests/test_factory_specification.py: refactoring
factory.py: add new api functions, add new cli args, refactoring
tests/test_factory_specification.py: fixing some tests