コード例 #1
0
    def test_no_groups(self, mock_manager):
        mock_manager.groups = None

        mock_aov1 = MagicMock(spec=manager.AOV)
        mock_aov2 = MagicMock(spec=manager.AOV)
        mock_aov3 = MagicMock(spec=manager.AOV)

        mock_manager.aovs = {"P": mock_aov1, "N": mock_aov2, "A": mock_aov3}

        result = manager.build_menu_script()

        self.assertEqual(result, ("A", "A", "N", "N", "P", "P"))
コード例 #2
0
    def test_no_groups(self, mocker):
        mock_manager = mocker.patch("ht.sohohooks.aovs.manager.MANAGER", autospec=True)

        mock_manager.groups = None

        mock_aov1 = mocker.MagicMock(spec=manager.AOV)
        mock_aov2 = mocker.MagicMock(spec=manager.AOV)
        mock_aov3 = mocker.MagicMock(spec=manager.AOV)

        mock_manager.aovs = {"P": mock_aov1, "N": mock_aov2, "A": mock_aov3}

        result = manager.build_menu_script()

        assert result == ("A", "A", "N", "N", "P", "P")
コード例 #3
0
    def test_with_groups(self, mocker):
        """Test when groups exist."""
        mock_manager = mocker.patch("ht.sohohooks.aovs.manager.MANAGER",
                                    autospec=True)

        mock_group1 = mocker.MagicMock(spec=manager.AOVGroup)
        mock_group2 = mocker.MagicMock(spec=manager.AOVGroup)
        mock_group3 = mocker.MagicMock(spec=manager.AOVGroup)

        mock_manager.groups = {
            "group1": mock_group1,
            "group2": mock_group2,
            "group3": mock_group3,
        }

        mock_aov1 = mocker.MagicMock(spec=manager.AOV)
        mock_aov2 = mocker.MagicMock(spec=manager.AOV)
        mock_aov3 = mocker.MagicMock(spec=manager.AOV)

        mock_manager.aovs = {"P": mock_aov1, "N": mock_aov2, "A": mock_aov3}

        result = manager.build_menu_script()

        expected = (
            "@group1",
            "group1",
            "@group2",
            "group2",
            "@group3",
            "group3",
            "_separator_",
            "",
            "A",
            "A",
            "N",
            "N",
            "P",
            "P",
        )

        assert result == expected
コード例 #4
0
    def test_with_groups(self, mock_manager):
        mock_group1 = MagicMock(spec=manager.AOVGroup)
        mock_group2 = MagicMock(spec=manager.AOVGroup)
        mock_group3 = MagicMock(spec=manager.AOVGroup)

        mock_manager.groups = {
            "group1": mock_group1,
            "group2": mock_group2,
            "group3": mock_group3,
        }

        mock_aov1 = MagicMock(spec=manager.AOV)
        mock_aov2 = MagicMock(spec=manager.AOV)
        mock_aov3 = MagicMock(spec=manager.AOV)

        mock_manager.aovs = {"P": mock_aov1, "N": mock_aov2, "A": mock_aov3}

        result = manager.build_menu_script()

        expected = ("@group1", "group1", "@group2", "group2", "@group3", "group3", "_separator_", "", "A", "A", "N", "N", "P", "P")

        self.assertEqual(result, expected)