def test_access_control_is_set_on_init(self):
    username = 'access_control_is_set_on_init'
    role_name = 'team-a'
    with self.app.app_context():
        user = fab_utils.create_user(self.app, username, role_name, permissions=[])
        self.expect_user_is_in_role(user, rolename='team-a')
        self.security_manager.sync_perm_for_dag('access_control_test', access_control={'team-a': [permissions.ACTION_CAN_EDIT, permissions.ACTION_CAN_READ]})
        self.assert_user_has_dag_perms(perms=[permissions.ACTION_CAN_EDIT, permissions.ACTION_CAN_READ], dag_id='access_control_test', user=user)
        self.expect_user_is_in_role(user, rolename='NOT-team-a')
        self.assert_user_does_not_have_dag_perms(perms=[permissions.ACTION_CAN_EDIT, permissions.ACTION_CAN_READ], dag_id='access_control_test', user=user)
def test_access_control_is_set_on_init(self):
    username = 'access_control_is_set_on_init'
    role_name = 'team-a'
    with self.app.app_context():
        user = fab_utils.create_user(self.app, username, role_name, permissions=[])
        self.expect_user_is_in_role(user, rolename='team-a')
        self.security_manager.sync_perm_for_dag('access_control_test', access_control={'team-a': [permissions.ACTION_CAN_EDIT, permissions.ACTION_CAN_READ]})
        self.assert_user_has_dag_perms(perms=[permissions.ACTION_CAN_EDIT, permissions.ACTION_CAN_READ], dag_id='access_control_test', user=user)
        self.expect_user_is_in_role(user, rolename='NOT-team-a')
        self.assert_user_does_not_have_dag_perms(perms=[permissions.ACTION_CAN_EDIT, permissions.ACTION_CAN_READ], dag_id='access_control_test', user=user)