autotest/autotest — pull request #751 by rbbratta (2013-09-26 22:10:35+00:00)
Title: fixup autotest-firewalld-add-service

### autotest-firewalld-add-service: move argparse to runtime instead of init

Unit-testing was trying to isolate individual methods by instantiating
App(), however App.__init__() was creating an argparser which was in
turn running firewall-cmd. Argparse setup should be delayed until
runtime so we can instantiate without side-effects.

### autotest_firewalld_add_service_unittest: fix module name

python identifiers can't contain '-', so when using imp.load_module replace '-'
with "_".

This seems to have no effect in reality. I'm not sure how
imp.load_module actually uses the first argument.

### autotest_firewalld_add_service_unittest: mock out argparse

Since we aren't testing argparse mock it out during module load. Use
a simple sys.modules hack.
autotest-firewalld-add-server: convert to Popen and add unit test

The docs say: subprocess.Popen is preferable to commands. Also convert
_get_default_zone to static method so we can unit test it without
argparse.

### autotest-firewalld-add-service: improve handling of missing default zone

The print_help() message wasn't useful when this script is run without
firewall-cmd present.
Change the _get_default_zone to return None is firewall-cmd fails, then
add a specific error message indicating that we can't find the default
zone.

Also remove the 'not (zone and service)' check, since we check each
individually.