'Tests access to flows.'

def testFlowAccess(self):

    client_id = ('C.' + ('a' * 16))
    self.assertRaises(grr_api_errors.AccessForbiddenError, self.api.Client(client_id).CreateFlow, name=flow_test_lib.SendingFlow.__name__)
    approval_urn = self.RequestAndGrantClientApproval(client_id, self.token)
    f = self.api.Client(client_id).CreateFlow(name=flow_test_lib.SendingFlow.__name__)
    self.RevokeClientApproval(approval_urn, self.token)
    self.assertRaises(grr_api_errors.AccessForbiddenError, self.api.Client(client_id).Flow(f.flow_id).Get)
    self.RequestAndGrantClientApproval(client_id, self.token)
    self.api.Client(client_id).Flow(f.flow_id).Get()
