Coverage for tests/test_cliCmdConfigValidate.py : 50%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
2# This file is part of daf_butler.
3#
4# Developed for the LSST Data Management System.
5# This product includes software developed by the LSST Project
6# (http://www.lsst.org).
7# See the COPYRIGHT file at the top-level directory of this distribution
8# for details of code ownership.
9#
10# This program is free software: you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation, either version 3 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program. If not, see <http://www.gnu.org/licenses/>.
23"""Unit tests for daf_butler CLI config-validate command.
24"""
26import unittest
28from lsst.daf.butler.cli import butler
29from lsst.daf.butler.cli.cmd import config_validate
30from lsst.daf.butler.cli.utils import LogCliRunner
31from lsst.daf.butler.tests import CliCmdTestBase
34class ValidateTest(CliCmdTestBase, unittest.TestCase):
35 defaultExpected = dict()
36 command = config_validate
39class ConfigValidateUseTest(unittest.TestCase):
40 """Test executing the command."""
42 def setUp(self):
43 self.runner = LogCliRunner()
45 def testConfigValidate(self):
46 """Test validating a valid config."""
47 with self.runner.isolated_filesystem():
48 result = self.runner.invoke(butler.cli, ["create", "here"])
49 self.assertEqual(result.exit_code, 0, result.stdout)
50 # verify the just-created repo validates without error
51 result = self.runner.invoke(butler.cli, ["config-validate", "here"])
52 self.assertEqual(result.exit_code, 0, result.stdout)
53 self.assertEqual(result.stdout, "No problems encountered with configuration.\n")
55 def testConfigValidate_ignore(self):
56 """Test the ignore flag"""
57 with self.runner.isolated_filesystem():
58 result = self.runner.invoke(butler.cli, ["create", "here"])
59 self.assertEqual(result.exit_code, 0, result.stdout)
60 # verify the just-created repo validates without error
61 result = self.runner.invoke(butler.cli, ["config-validate", "here",
62 "--ignore", "storageClasses,repoTransferFormats",
63 "-i", "dimensions"])
64 self.assertEqual(result.exit_code, 0, result.stdout)
65 self.assertEqual(result.stdout, "No problems encountered with configuration.\n")
68if __name__ == "__main__": 68 ↛ 69line 68 didn't jump to line 69, because the condition on line 68 was never true
69 unittest.main()