コード例 #1
0
 def test_no_target_found(self):
     all_targets_data = {
         "Target_1": "some attributes",
         "Target_2": "some more attributes",
     }
     with self.assertRaises(TargetNotFoundError):
         _extract_target_attributes(all_targets_data, "Unlisted_Target")
コード例 #2
0
 def test_target_private(self):
     all_targets_data = {
         "Target_1": {"attribute1": "something", "public": False},
         "Target_2": "some more attributes",
     }
     with self.assertRaises(TargetNotFoundError):
         _extract_target_attributes(all_targets_data, "Target_1"),
コード例 #3
0
 def test_target_public(self):
     all_targets_data = {
         "Target_1": {"attribute1": "something", "public": True},
         "Target_2": "some more attributes",
     }
     # The public attribute affects visibility but is removed from result
     self.assertEqual(_extract_target_attributes(all_targets_data, "Target_1"), {"attribute1": "something"})
コード例 #4
0
    def test_target_found(self):
        target_attributes = {"attribute1": "something"}

        all_targets_data = {
            "Target_1": target_attributes,
            "Target_2": "some more attributes",
        }
        # When not explicitly included public is assumed to be True
        self.assertEqual(_extract_target_attributes(all_targets_data, "Target_1"), target_attributes)