Beispiel #1
0
 def test_order_set_full(self):
     self.order_set_entity.metadata.update({
         "symmetrical": "true",
         "kind": "Optional",
         "require-all": "true",
         "score": "100",
         "unsupported": "value",
     })
     self.order_set_entity.metadata["sets"].append({
         "members": ["d9", "d8", "d6", "d7"],
         "metadata": {
             "sequential": "true",
             "require-all": "false",
             "score": "10",
             "ordering": "value",
             "action": "start",
             "role": "promoted",
             "kind": "Optional",
             "unsupported": "value",
         },
     })
     obj = relations.RelationPrintableNode(self.order_set_entity, [], False)
     self.assertEqual("order set (order_set_id)",
                      obj.get_title(verbose=True))
     self.assertEqual(
         [
             "kind=Optional require-all=true score=100 symmetrical=true",
             "   set d1 d2 d3",
             "   set d4 d5 d0 (require-all=false score=10 sequential=true)",
             "   set d9 d8 d6 d7 (action=start kind=Optional ordering=value "
             "require-all=false role=promoted score=10 sequential=true)",
         ],
         obj.detail,
     )
Beispiel #2
0
 def test_multiple_inner_resources(self):
     obj = relations.RelationPrintableNode(
         RelationEntityDto("inner:g1", ResourceRelationType.INNER_RESOURCES,
                           ["m1", "m2", "m0"], {"id": "g1"}),
         [],
         False,
     )
     self.assertEqual("inner resource(s) (g1)", obj.title)
     self.assertEqual(["members: m1 m2 m0"], obj.detail)
Beispiel #3
0
 def test_order_set_not_verbose(self):
     obj = relations.RelationPrintableNode(self.order_set_entity, [], False)
     self.assertEqual("order set", obj.get_title(verbose=False))
     self.assertEqual(
         [
             "   set d1 d2 d3",
             "   set d4 d5 d0 (require-all=false score=10 sequential=true)",
         ],
         obj.detail,
     )
Beispiel #4
0
 def test_unknown(self):
     obj = relations.RelationPrintableNode(
         RelationEntityDto("random", "undifined type", [], {
             "id": "random_id",
         }),
         [],
         False,
     )
     self.assertEqual("<unknown> (random_id)", obj.title)
     self.assertEqual([], obj.detail)
Beispiel #5
0
 def test_unknown_not_verbose(self):
     obj = relations.RelationPrintableNode(
         RelationEntityDto("random", "undifined type", [], {
             "id": "random_id",
         }),
         [],
         False,
     )
     self.assertEqual("<unknown>", obj.get_title(verbose=False))
     self.assertEqual([], obj.detail)
Beispiel #6
0
 def test_outer_resource(self):
     obj = relations.RelationPrintableNode(
         RelationEntityDto("outer:g1", ResourceRelationType.OUTER_RESOURCE,
                           [], {
                               "id": "g1",
                           }),
         [],
         False,
     )
     self.assertEqual("outer resource (g1)", obj.title)
     self.assertEqual([], obj.detail)
Beispiel #7
0
 def test_inner_resources(self):
     obj = relations.RelationPrintableNode(
         RelationEntityDto("inner:g1", ResourceRelationType.INNER_RESOURCES,
                           ["m0"], {
                               "id": "g1",
                           }),
         [],
         False,
     )
     self.assertEqual("inner resource(s) (g1)", obj.get_title(verbose=True))
     self.assertEqual([], obj.detail)
Beispiel #8
0
 def test_outer_resourcenot_verbose(self):
     obj = relations.RelationPrintableNode(
         RelationEntityDto(
             "outer:g1",
             ResourceRelationType.OUTER_RESOURCE,
             [],
             {
                 "id": "g1",
             },
         ),
         [],
         False,
     )
     self.assertEqual("outer resource", obj.get_title(verbose=False))
     self.assertEqual([], obj.detail)
Beispiel #9
0
 def test_order_full(self):
     self.order_entity.metadata.update({
         "kind": "Optional",
         "symmetrical": "true",
         "unsupported": "value",
         "score": "1000",
     })
     obj = relations.RelationPrintableNode(self.order_entity, [], False)
     self.assertEqual("order (order1)", obj.get_title(verbose=True))
     self.assertEqual(
         [
             "start d1 then start d2",
             "kind=Optional score=1000 symmetrical=true",
         ],
         obj.detail,
     )
Beispiel #10
0
 def test_order(self):
     obj = relations.RelationPrintableNode(self.order_entity, [], False)
     self.assertEqual("order (order1)", obj.get_title(verbose=True))
     self.assertEqual(["start d1 then start d2"], obj.detail)