def test_prints_test_schema_when_one_installed(self, capfd): """ Should print the schema when a single tester is installed """ with patch("glob.glob", return_value=self.fake_installed_testers(["custom"])): cli.get_schema() out, _err = capfd.readouterr() schema = json.loads(out) self.assert_tester_in_schema("custom", schema)
def test_prints_test_schema_when_multiple_installed(self, capfd): with patch( "glob.glob", return_value=self.fake_installed_testers(["custom", "py"]) ): cli.get_schema() out, _err = capfd.readouterr() schema = json.loads(out) self.assert_tester_in_schema("custom", schema) self.assert_tester_in_schema("py", schema)
def test_prints_skeleton_when_none_installed(self, capfd): """ Should still print the schema skeleton when no tester is installed """ with patch("glob.glob", return_value=[]): cli.get_schema() out, _err = capfd.readouterr() schema = json.loads(out) root_dir = os.path.dirname(os.path.abspath(cli.__file__)) with open(os.path.join(root_dir, "lib", "tester_schema_skeleton.json")) as f: skeleton = json.load(f) assert schema == skeleton