Fix formatting issues

Code should be formatted via black.

Signed-off-by: Haibo Lin <hlin@redhat.com>
This commit is contained in:
Haibo Lin 2020-02-07 13:53:20 +08:00
parent 56fea60595
commit 9b12be7300
5 changed files with 46 additions and 43 deletions

View file

@ -10,29 +10,37 @@ from tests import helpers
HERE = os.path.abspath(os.path.dirname(__file__))
DUMMY_CONFIG = os.path.join(HERE, 'data/dummy-pungi.conf')
SCHEMA_OVERRIDE = os.path.join(HERE, 'data/dummy-override.json')
DUMMY_CONFIG = os.path.join(HERE, "data/dummy-pungi.conf")
SCHEMA_OVERRIDE = os.path.join(HERE, "data/dummy-override.json")
class ConfigValidateScriptTest(helpers.PungiTestCase):
@mock.patch('sys.argv', new=['pungi-config-validate', DUMMY_CONFIG])
@mock.patch('sys.stderr', new_callable=six.StringIO)
@mock.patch('sys.stdout', new_callable=six.StringIO)
@mock.patch("sys.argv", new=["pungi-config-validate", DUMMY_CONFIG])
@mock.patch("sys.stderr", new_callable=six.StringIO)
@mock.patch("sys.stdout", new_callable=six.StringIO)
def test_validate_dummy_config(self, stdout, stderr):
cli_main()
self.assertEqual('', stdout.getvalue())
self.assertEqual('', stderr.getvalue())
self.assertEqual("", stdout.getvalue())
self.assertEqual("", stderr.getvalue())
@mock.patch('sys.argv', new=[
'pungi-config-validate', DUMMY_CONFIG, "--schema-override",
SCHEMA_OVERRIDE])
@mock.patch('sys.stderr', new_callable=six.StringIO)
@mock.patch('sys.stdout', new_callable=six.StringIO)
@mock.patch('sys.exit')
@mock.patch(
"sys.argv",
new=[
"pungi-config-validate",
DUMMY_CONFIG,
"--schema-override",
SCHEMA_OVERRIDE,
],
)
@mock.patch("sys.stderr", new_callable=six.StringIO)
@mock.patch("sys.stdout", new_callable=six.StringIO)
@mock.patch("sys.exit")
def test_schema_override(self, exit, stdout, stderr):
cli_main()
self.assertTrue(stdout.getvalue().startswith(
"Failed validation in pkgset_source: 'repos' is not one of"))
self.assertEqual('', stderr.getvalue())
self.assertTrue(
stdout.getvalue().startswith(
"Failed validation in pkgset_source: 'repos' is not one of"
)
)
self.assertEqual("", stderr.getvalue())
exit.assert_called_once_with(1)