Exemplo n.º 1
0
    def test_ticket_permissions_for_board_member(self):
        board_membership = BoardMembershipFactory()
        ticket = TicketFactory(category=CategoryFactory(board_id=board_membership.board_id))

        permissions = PermissionsService.get_ticket_permissions(
            ticket_id=ticket.id,
            user_id=board_membership.organization_membership.user_id,
        )
        self._assert_has_all_permissions(permissions)
Exemplo n.º 2
0
    def test_ticket_permissions_for_not_a_board_member(self):
        ticket = TicketFactory()
        organization_membership = OrganizationMembershipFactory(
            organization_id=ticket.category.board.organization_id,
        )

        permissions = PermissionsService.get_ticket_permissions(
            ticket_id=ticket.id,
            user_id=organization_membership.user_id,
        )
        self._assert_has_no_permissions(permissions)
Exemplo n.º 3
0
 def test_ticket_permissions_ticket_not_found(self):
     permissions = PermissionsService.get_ticket_permissions(
         ticket_id=-1,
         user_id=UserFactory().id,
     )
     self._assert_has_no_permissions(permissions)
Exemplo n.º 4
0
 def test_ticket_permissions_for_a_random_user(self):
     permissions = PermissionsService.get_ticket_permissions(
         ticket_id=TicketFactory().id,
         user_id=UserFactory().id,
     )
     self._assert_has_no_permissions(permissions)