コード例 #1
0
    def test_get_next_section(self):
        content = ContentBuilder([
            {
                "id": "first_section",
                "name": "First section",
                "questions": [{
                    "question": 'First question',
                    "depends": [{
                        "on": "lot",
                        "being": ["SCS", "SaaS", "PaaS"]
                    }]
                }]
            },
            {
                "id": "second_section",
                "name": "Second section",
                "questions": [{
                    "question": 'First question',
                    "depends": [{
                        "on": "lot",
                        "being": ["SCS", "SaaS", "PaaS"]
                    }]
                }]
            },
            {
                "id": "third_section",
                "name": "Third section",
                "editable": True,
                "questions": [{
                    "question": 'First question',
                    "depends": [{
                        "on": "lot",
                        "being": ["SCS", "SaaS", "PaaS"]
                    }]
                }]
            },
        ])

        assert content.get_next_section_id() == "first_section"
        assert content.get_next_section_id("first_section") == "second_section"
        assert content.get_next_section_id("second_section") == "third_section"
        assert content.get_next_section_id("third_section") is None

        assert content.get_next_editable_section_id() == "third_section"
        assert content.get_next_editable_section_id(
            "second_section") == "third_section"