@@ -0,0 +1,1988 @@
+from TM1py import TM1Queries, Annotation%0Aimport uuid%0Aimport json%0Aimport unittest%0A%0A%0Aclass TestAnnotationMethods(unittest.TestCase):%0A    q = TM1Queries(ip='', port=8008, user='admin', password='apple', ssl=True)%0A%0A    def test_get_all_annotations_from_cube(self):%0A        annotations = self.q.get_all_annotations_from_cube('plan_BudgetPlan')%0A        for annotation in annotations:%0A            self.assertIsInstance(annotation, Annotation)%0A%0A    def test_get_annotation(self):%0A        first_annotation = self.q.get_all_annotations_from_cube('plan_BudgetPlan')%5B0%5D%0A        annotation_id = first_annotation._id%0A%0A        annotation = self.q.get_annotation(annotation_id)%0A        self.assertIsInstance(annotation, Annotation)%0A%0A    def test_update_annotation(self):%0A        first_annotation = self.q.get_all_annotations_from_cube('plan_BudgetPlan')%5B0%5D%0A        random_string = str(uuid.uuid4())%0A%0A        first_annotation._comment_value = random_string%0A        response = self.q.update_annotation(first_annotation)%0A%0A        self.assertIn(random_string, response)%0A%0A    def test_create_annotation(self):%0A        second_annotation = self.q.get_all_annotations_from_cube('plan_BudgetPlan')%5B1%5D%0A        response = self.q.create_annotation(second_annotation)%0A        created_annotation = json.loads(response)%0A%0A        annotation_id = created_annotation%5B'ID'%5D%0A        annotation = self.q.get_annotation(annotation_id)%0A%0A        self.assertIsInstance(annotation, Annotation)%0A%0A    def test_delete_annotation(self):%0A        annotations = self.q.get_all_annotations_from_cube('plan_BudgetPlan')%0A        number_annotations_at_start = len(annotations)%0A%0A        last_annotation = annotations%5B-1%5D%0A        self.q.delete_annotation(last_annotation._id)%0A%0A        annotations = self.q.get_all_annotations_from_cube('plan_BudgetPlan')%0A        number_annotations_at_end = len(annotations)%0A%0A        self.assertEqual(number_annotations_at_start, number_annotations_at_end + 1)%0A%0A%0Aif __name__ == '__main__':%0A    unittest.main()%0A

Create Annotation.py