示例#1
0
def test_already_consildated(fake_results):
    """Make sure we can consolidate before preparing."""

    results = formatting.consolidate(fake_results)
    with patch.object(formatting, "consolidate") as patched:
        formatting.prepare_results(results)

    assert not patched.called
示例#2
0
def test_already_consildated(fake_results):
    """Make sure we can consolidate before preparing."""

    results = formatting.consolidate(fake_results)
    with patch.object(formatting, "consolidate") as patched:
        formatting.prepare_results(results)

    assert not patched.called
示例#3
0
def test_csv_on_consolidated(fake_results, capfd):
    """CSV results should still work post consolidation."""

    result_set = formatting.consolidate(fake_results)
    formatting.csv_results(result_set, {})
    stdout, _ = capfd.readouterr()
    assert "server,command,result" in stdout
    for server in result_set:
        assert " ".join(server["names"]) in stdout
        for _, results in server["results"]:
            assert results in stdout
示例#4
0
def test_csv_on_consolidated(fake_results, capfd):
    """CSV results should still work post consolidation."""

    result_set = formatting.consolidate(fake_results)
    formatting.csv_results(result_set, {})
    stdout, _ = capfd.readouterr()
    assert "server,command,result" in stdout
    for server in result_set:
        assert " ".join(server["names"]) in stdout
        for _, results in server["results"]:
            assert results in stdout
示例#5
0
    def test_csv_on_consolidated(self):
        """CSV results should still work post consolidation."""

        result_set = formatting.consolidate(self.fake_results)
        formatting.csv_results(result_set, {})
        stdout = sys.stdout.getvalue().strip()
        self.assertIn("server,command,result", stdout)
        for server in result_set:
            self.assertIn(" ".join(server["names"]), stdout)
            for _, results in server["results"]:
                self.assertIn(results, stdout)
示例#6
0
def test_consolidate_results(fake_results):
    """Consolidate should merge matching server result sets."""

    expected_groups = [
        ["server_a_1", "server_a_2", "server_a_3", "server_a_4"],
        ["server_b_1", "server_b_2", "server_b_3"],
        ["server_c_1"],
    ]

    for result_set in formatting.consolidate(fake_results):
        assert "names" in result_set
        assert isinstance(result_set["names"], list)
        assert "name" not in result_set
        assert result_set["names"] in expected_groups
示例#7
0
def test_consolidate_results(fake_results):
    """Consolidate should merge matching server result sets."""

    expected_groups = [
        ["server_a_1", "server_a_2", "server_a_3", "server_a_4"],
        ["server_b_1", "server_b_2", "server_b_3"],
        ["server_c_1"],
    ]

    for result_set in formatting.consolidate(fake_results):
        assert "names" in result_set
        assert isinstance(result_set["names"], list)
        assert "name" not in result_set
        assert result_set["names"] in expected_groups
示例#8
0
    def test_consolidte_results(self):
        """Consolidate should merge matching server result sets."""

        expected_groups = [
            ["server_a_1", "server_a_2", "server_a_3", "server_a_4"],
            ["server_b_1", "server_b_2", "server_b_3"],
            ["server_c_1"],
        ]

        for result_set in formatting.consolidate(self.fake_results):
            self.assertIn("names", result_set)
            self.assertIsInstance(result_set["names"], list)
            self.assertNotIn("name", result_set)
            self.assertIn(result_set["names"], expected_groups)