(self)
| 14 | class TestPlanner: |
| 15 | |
| 16 | def setup_class(self): |
| 17 | credentials = ("client id","client secret") |
| 18 | self.account = Account( |
| 19 | (Config.CLIENT_ID), |
| 20 | scopes=["basic"], |
| 21 | tenant_id=Config.TENANT_ID, |
| 22 | username=Config.EMAIL, |
| 23 | password=Config.PASSWORD, |
| 24 | auth_flow_type='password', |
| 25 | token_backend = EnvTokenBackend() |
| 26 | ) |
| 27 | self.account.authenticate() |
| 28 | self.planner = self.account.planner() |
| 29 | |
| 30 | test_plan_name = "plan_" + ''.join(choices(printable, k=randint(10, 20))) |
| 31 | log.info(f"Creating Plan: {test_plan_name}...") |
| 32 | self.plan = self.planner.create_plan(owner=Config.GROUP_ID, title=test_plan_name) |
| 33 | |
| 34 | test_bucket_name = "bucket_" + ''.join(choices(printable, k=randint(10, 20))) |
| 35 | log.info(f"Creating Bucket: {test_bucket_name}...") |
| 36 | self.bucket = self.plan.create_bucket(name = test_bucket_name) |
| 37 | |
| 38 | test_task_name = "task_" + ''.join(choices(printable, k=randint(10, 20))) |
| 39 | log.info(f"Creating Task: {test_task_name}...") |
| 40 | self.task = self.bucket.create_task( |
| 41 | title=test_task_name, |
| 42 | assignments={ |
| 43 | Config.USER_ID : { |
| 44 | "@odata.type": "microsoft.graph.plannerAssignment", |
| 45 | "orderHint": " !" #Optional |
| 46 | } |
| 47 | }, |
| 48 | #optional kwargs |
| 49 | priority = choices([1, 3, 5, 9], k=1)[0], #1 -> "urgent", 3 -> "important", 5 -> "medium", 9 -> "low" |
| 50 | order_hint = " !", #order_hint is a delicate matter. here i will always use default value " !" |
| 51 | start_date_time = datetime.now(), |
| 52 | due_date_time= datetime.now() + timedelta(days=1), |
| 53 | assignee_priority = " !", |
| 54 | percent_complete = randint(0, 100), |
| 55 | applied_categories = {f"category{i}" : randint(0,1) == 1 for i in range(1, 25) if randint(0,1)} |
| 56 | ) |
| 57 | self.taskDetail = self.task.get_details() |
| 58 | self.planDetail = self.plan.get_details() |
| 59 | |
| 60 | |
| 61 | def teardown_class(self): |
nothing calls this directly
no test coverage detected