Пример #1
0
    def test_node_comparison(self, service_template1,
                             service_template2):
        comparer = TemplateComparer()
        node1_1 = service_template1[0].get_node("hello-1")
        node2_1 = service_template2[0].get_node("hello-1")
        context = TemplateContext(node1_1, node2_1,
                                  service_template1[2],
                                  service_template2[2])
        equal, diff = comparer._compare_node(node1_1, node2_1, context)  # pylint: disable=protected-access

        assert equal is False

        assert "capabilities" in diff.changed
        assert "interfaces" in diff.changed
        assert "properties" in diff.changed
        assert "requirements" not in diff.changed
        assert "types" not in diff.changed

        node1_2 = service_template1[0].get_node("hello-2")
        node2_2 = service_template2[0].get_node("hello-2")
        context = TemplateContext(node1_2, node2_2, service_template1[2], service_template2[2])
        equal, diff = comparer._compare_node(node1_2, node2_2, context)  # pylint: disable=protected-access

        assert equal is False

        assert "capabilities" in diff.changed
        assert "interfaces" in diff.changed
        assert "properties" in diff.changed
        assert "requirements" in diff.changed
        assert "types" in diff.changed
Пример #2
0
    def test_requirement_comparison(self, service_template1,
                                    service_template2):
        comparer = TemplateComparer()
        node1 = service_template1[0].get_node("hello-6")
        node2 = service_template2[0].get_node("hello-6")
        context = TemplateContext(node1, node2, service_template1[2], service_template2[2])
        equal, diff = comparer._compare_node(node1, node2, context)  # pylint: disable=protected-access

        assert equal is False

        assert "requirements" in diff.changed
        assert "dependency" in diff.changed["requirements"].changed
        assert "target" in diff.changed["requirements"].changed["dependency"].changed
Пример #3
0
    def test_interface_comparison(self, service_template1,
                                  service_template2):
        comparer = TemplateComparer()
        node1 = service_template1[0].get_node("hello-1")
        node2 = service_template2[0].get_node("hello-1")
        context = TemplateContext(node1, node2, service_template1[2], service_template2[2])
        equal, diff = comparer._compare_node(node1, node2, context)  # pylint: disable=protected-access

        assert equal is False

        assert "interfaces" in diff.changed
        assert "create" in diff.changed["interfaces"].changed["Standard"].changed["operations"].changed
        assert "artifacts" in \
               diff.changed["interfaces"].changed["Standard"].changed["operations"].changed["create"].changed
        assert "inputs" in \
               diff.changed["interfaces"].changed["Standard"].changed["operations"].changed["create"].changed