def start_mocking_service(self, service, port): if service in service_lut.keys(): if self.servers[service]: self.stop_mocking_service(service) self.servers[service] = subprocess.Popen([ '{}/bin/moto_server'.format(sys.base_exec_prefix), service, '-p{}'.format(port) ])
def stop_mocking_services(self, *args): """ Stop mocking services Args: args (`list`): a list of mocking services you want to stop. If it is empty, all services will be stopped """ if not args: args = service_lut.keys() for service in args: self.stop_mocking_service(service)
def __init__(self): self.default_dbconfig = [ns.to_dict() for ns in db.ConfigNamespace.find()] self.scheduler = None self.api_server = None self.servers = {} for service in service_lut.keys(): self.servers[service] = None self.empty_tables = empty_tables self.has_resource = has_resource self.get_resource = get_resource self.modify_resource = modify_resource self.verify = verify
def stop_mocking_service(self, service_name): if service_name in service_lut.keys() and self.servers[service_name]: self.servers[service_name].kill() self.servers[service_name] = None