def test_manager_can_edit_participants_profile(self): team = FakeTeamFactory.create(project=self.project) member = team.add_member( user_from=self.super_user, email=faker.email(), name=faker.name(), ) relation, _ = ConsultantProjectRole.objects.get_or_create_consultant( user_from=self.super_user, project=team.project, consultant=FakeConsultantFactory(user__is_active=True), exo_role=ExORole.objects.get( code=settings.EXO_ROLE_CODE_SPRINT_HEAD_COACH), ) self.assertTrue( relation.consultant.user.has_perm( settings.EXO_ACCOUNTS_PERMS_USER_EDIT, member)) # add a new member member2 = team.add_member( user_from=relation.consultant.user, email=faker.email(), name=faker.name(), ) has_perm = relation.consultant.user.has_perm( settings.EXO_ACCOUNTS_PERMS_USER_EDIT, member2) self.assertTrue(has_perm) team.remove_member(relation.consultant.user, member2) self.assertFalse( relation.consultant.user.has_perm( settings.EXO_ACCOUNTS_PERMS_USER_EDIT, member2))
def build_group_user(self, user): data = { 'userFrom': user.uuid, 'groups': [ {'name': 'Group1', 'users': []}, {'name': 'Group2', 'users': []}, ], 'group_type': settings.CONVERSATIONS_CH_USER, } for group in data['groups']: group['users'].append({ 'user_uuid': str(uuid.uuid4()), 'name': faker.name(), 'profile_picture': faker.image_url(), 'profile_url': faker.uri(), 'short_title': faker.word() }) group['users'].append({ 'user_uuid': str(user.uuid), 'name': faker.name(), 'profile_picture': faker.image_url(), 'profile_url': faker.uri(), 'short_title': faker.word() }) return data
def test_create_team_invitations_with_members(self): member_list = [{ 'email': faker.email(), 'short_name': faker.name() } for _ in range(2)] sprint = FakeSprintAutomatedFactory( status=settings.PROJECT_CH_PROJECT_STATUS_WAITING) project = sprint.project_ptr coach = FakeConsultantFactory(user__is_active=True) ConsultantProjectRole.objects.get_or_create_consultant( user_from=self.super_user, consultant=coach, project=project, exo_role=ExORole.objects.get( code=settings.EXO_ROLE_CODE_SPRINT_COACH), ) team = Team.objects.create( user_from=self.super_user, created_by=self.super_user, project=project, name=faker.name(), coach=coach, stream=settings.PROJECT_STREAM_CH_STARTUP, team_members=member_list, ) self.assertIsNotNone(team) self.assertEqual( Invitation.objects.filter( type=settings.INVITATION_TYPE_TEAM).count(), 3, )
def test_pending_user_non_consultant_application_consultant(self, mock_request, mock_email): # PREPARE DATA mock_request.register_uri( 'POST', get_root_payments_url() + settings.EXO_CERTIFICATION_PAYMENTS_API_URL, json=get_payment_mock() ) user = FakeUserFactory.create() cert_request = CertificationRequest.objects.create( requester_email=user.email, requester_name=user.full_name, user=user, certification=ExOCertification.objects.get( level=settings.EXO_CERTIFICATION_CERTIFICATION_CH_LEVEL_2 ), ) payload = { 'country': 'PT', 'recaptcha': faker.word(), 'billingName': faker.name(), 'taxId': faker.word(), 'billingAddress': faker.address(), 'companyName': faker.name(), 'cohort': self.cohort_lvl_2.pk, 'application_details': self.generate_application_details_data(), } url = reverse('api:exo-certification:applications-detail', kwargs={'pk': cert_request.pk}) # DO ACTION response = self.client.put(url, data=payload) # ASSERTS self.assertTrue(status.is_success(response.status_code)) data = response.json() self.assertIsNotNone(data.get('nextUrl'))
def build_groups(self, user): data = { 'userFrom': user.uuid, 'groups': [ {'name': 'Group1', 'users': []}, {'name': 'Group2', 'users': []}, ], 'group_type': settings.CONVERSATIONS_CH_PROJECT, } users_duplicated = [str(uuid.uuid4())] for group in data['groups']: for _ in range(5): group['users'].append({ 'user_uuid': str(uuid.uuid4()), 'name': faker.name(), 'profile_picture': faker.image_url(), 'profile_url': faker.uri(), 'short_title': faker.word() }) for user_duplicated in users_duplicated: group['users'].append({ 'user_uuid': user_duplicated, 'name': faker.name(), 'profile_picture': faker.image_url(), 'profile_url': faker.uri(), 'short_title': faker.word() }) return data
def test_email(self): team1 = FakeTeamFactory.create(project=self.sprint.project_ptr) team2 = FakeTeamFactory.create(project=self.sprint.project_ptr) self.client.login(username=self.super_user.username, password='******') user1 = team1.add_member( user_from=self.super_user, email=faker.email(), name=faker.name(), ) team2.add_member( user_from=self.super_user, email=faker.email(), name=faker.name(), ) url = reverse('api:project:team:send-email', kwargs={'project_id': self.sprint.project_ptr.pk}) data = { 'teams[0]id': team1.pk, 'teams[1]id': team2.pk, 'subject': faker.word(), 'message': faker.word(), } response = self.client.post(url, data=data, format='multipart') self.assertTrue(status.is_success(response.status_code)) self.assertEqual(len(mail.outbox), 2) message = mail.outbox[0] self.assertEqual(message.to, [user1.email]) self.assertEqual(message.from_email, self.super_user.email)
def test_change_contracting(self): consultant = FakeConsultantFactory.create() ContractingData.objects.create( profile=consultant.exo_profile, name=faker.name(), address=faker.address(), company_name=faker.company(), ) self.client.login( username=self.super_user.username, password='******', ) url = reverse( 'api:profile:change-contracting', kwargs={'pk': consultant.user.pk}, ) data = { 'name': faker.name(), 'address': faker.address(), 'company_name': faker.company(), } response = self.client.put(url, data=data, format='json') self.assertTrue(status.is_success(response.status_code)) self.assertTrue( consultant.exo_profile.contracting_data.name, data['name'], ) self.assertEqual(ContractingData.objects.count(), 1)
def create_application(self, consultant=None, level=None): certification_level = level or settings.EXO_CERTIFICATION_CERTIFICATION_CH_LEVEL_2 cert_request = CertificationRequest.objects.create( user=consultant.user, requester_email=consultant.user.email, requester_name=consultant.user.full_name, certification=ExOCertification.objects.get( level=certification_level), ) if certification_level == settings.EXO_CERTIFICATION_CERTIFICATION_CH_LEVEL_2: cohort = self.cohort_lvl_2.pk elif certification_level == settings.EXO_CERTIFICATION_CERTIFICATION_CH_LEVEL_3: cohort = self.cohort_lvl_3.pk payload = { 'country': 'NO', 'recaptcha': faker.word(), 'billingName': faker.name(), 'taxId': faker.word(), 'billingAddress': faker.address(), 'companyName': faker.name(), 'cohort': cohort, 'application_details': { 'reasons': ' '.join(faker.words()), 'whereMetUs': faker.word(), } } self.client.put( reverse('api:exo-certification:applications-detail', kwargs={'pk': cert_request.pk}), data=payload, )
def test_edit_contracting_data(self): # PREPARE DATA consultant = FakeConsultantFactory.create( status=settings.CONSULTANT_STATUS_CH_ACTIVE) contracting_data = ContractingData.objects.create( profile=consultant.exo_profile, name=faker.name(), address=faker.address(), company_name=faker.company(), ) url = reverse( 'api:accounts:user-contracting-data', kwargs={'uuid': consultant.user.uuid.__str__()}) new_data = { 'name': faker.name(), 'address': faker.address(), 'company_name': faker.company(), 'tax_id': '2522', } # DO ACTION response = self.client.put( url, format='json', data=new_data, HTTP_USERNAME=settings.AUTH_SECRET_KEY) # ASSERTS contracting_data.refresh_from_db() self.assertTrue(status.is_success(response.status_code)) self.assertEqual(contracting_data.name, new_data['name'])
def crete_certification_groups(self): self.consultant_group = CertificationGroup.objects.create( name=faker.name(), _type=settings.CERTIFICATION_CH_GROUP_CH_TYPE_CONSULTANT, ) self.coach_group = CertificationGroup.objects.create( name=faker.name(), _type=settings.CERTIFICATION_CH_GROUP_CH_TYPE_COACH, )
def test_assignment_step_deliverables_files(self): # PREPARE DATA assignment_step_team = self.team.assignment_step_teams.all().first() coach = self.project.project_roles.get(code=settings.EXO_ROLE_CODE_SPRINT_COACH) user_coach = self.get_user() UserProjectRole.objects.create( project_role=coach, user=user_coach, teams=self.project.teams.all()) user_participant = UserProjectRole.objects.create_participant( project=self.project, teams=self.project.teams.all(), name=faker.name(), email=faker.email()).user other_user_participant = UserProjectRole.objects.create_participant( project=self.project, name=faker.name(), teams=self.project.teams.all(), email=faker.email()).user step_team_content_type = ContentType.objects.get_for_model(assignment_step_team) self.project._active_roles(self.super_user) FakeUploadedFileFactory( content_type=step_team_content_type, object_id=assignment_step_team.pk, visibility=settings.FILES_VISIBILITY_GROUP) FakeUploadedFileFactory( content_type=step_team_content_type, object_id=assignment_step_team.pk, visibility=settings.FILES_VISIBILITY_PRIVATE) FakeUploadedFileFactory( content_type=step_team_content_type, object_id=assignment_step_team.pk, visibility=settings.FILES_VISIBILITY_PRIVATE, created_by=user_participant) file_without_visibility_relation = FakeUploadedFileFactory( content_type=step_team_content_type, object_id=assignment_step_team.pk) file_without_visibility_relation.visibility.all().delete() # DO ACTION files_response_for_superuser = assignment_step_team.uploaded_files_with_visibility(self.super_user) files_response_for_user_coach = assignment_step_team.uploaded_files_with_visibility(user_coach) files_response_for_team_member = assignment_step_team.uploaded_files_with_visibility( other_user_participant) files_response_for_team_member_other = assignment_step_team.uploaded_files_with_visibility( user_participant) # ASSERTS self.assertEqual(len(files_response_for_superuser), 4) self.assertEqual(len(files_response_for_user_coach), 4) self.assertEqual(len(files_response_for_team_member), 2) self.assertEqual(len(files_response_for_team_member_other), 3)
def generate_fake_data(self): return { 'firstName': faker.first_name(), 'lastName': faker.last_name(), 'email': faker.email(), 'password': faker.password(), 'recaptcha': faker.word(), 'entry_point': { 'refereal': faker.name(), 'website': 'canvas', 'name': 'GET_CERTIFIED_FORM', 'city': faker.name(), } }
def get_members(self): member1 = self.sprint.project_ptr.add_user_project_member( self.super_user, faker.name(), faker.email(), ) member2 = self.sprint_training.project_ptr.add_user_project_member( self.super_user, faker.name(), faker.email(), ) return [ member1.projects_member.first(), member2.projects_member.first() ]
def test_api_create_generic_project(self): # PREPARE DATA url = reverse('api:project:create-service') customer = FakeCustomerFactory.create() duration = random.randint(1, 100) data = { 'type_project': settings.PROJECT_CH_TYPE_GENERIC_PROJECT, 'name': faker.name(), 'duration': duration, 'lapse': settings.PROJECT_LAPSE_PERIOD, 'customer': customer.id, } self.client.login(username=self.super_user.username, password='******') # DO ACTION response = self.client.post(url, data=data) # ASSERTS self.assertEqual(response.status_code, status.HTTP_201_CREATED) generic_project = GenericProject.objects.get(id=response.data.get('id')) self.assertEqual(generic_project.name, data.get('name')) self.assertEqual(generic_project.duration, duration) self.assertEqual(generic_project.lapse, settings.PROJECT_LAPSE_PERIOD) self.assertEqual(generic_project.customer.pk, customer.pk) self.assertEqual(generic_project.settings.version, settings.PROJECT_CH_VERSION_2)
def test_update_participant_list(self, mock_request): # PREPARE DATA self.init_mock(mock_request) self.setup_credentials(self.super_user) self.create_mommy_participant( self.event, user=self.get_user(mock_user=True, is_consultant=True), user_role=settings.EXO_ROLE_CODE_SUMMIT_PARTICIPANT, ) data = { 'full_name': faker.name(), 'user_email': faker.email(), } participant = self.event.participants.first() previous_user = participant.user url = reverse('api:event:participant-detail', kwargs={ 'event_id': self.event.uuid.__str__(), 'pk': participant.pk }) # DO ACTION response = self.client.put(url, data=data, format='json') # ASSERTS self.assertTrue(status.is_success(response.status_code)) participant.refresh_from_db() self.assertEqual(participant.user_name, data['full_name']) self.assertEqual(participant.user_email, data['user_email']) self.assertEqual(participant.user, previous_user)
def test_modify_advisor_request_settings(self, mock_request): self.init_mock(mock_request) url = reverse('api:project-advisor-request-settings', kwargs={'pk': self.project.pk}) # ASSERTS self.setup_credentials(self.super_user) data = { 'entity': faker.name(), 'duration_unity': settings.OPPORTUNITIES_DURATION_UNITY_HOUR, 'duration_value': 1, 'total': 10, 'budgets': [{ 'budget': '222', 'currency': settings.OPPORTUNITIES_CH_CURRENCY_DOLLAR }, { 'budget': '1', 'currency': settings.OPPORTUNITIES_CH_CURRENCY_EXOS }], } response = self.client.put(url, data=data) self.assertTrue(status.is_success(response.status_code)) advisor_request_settings = self.project.advisor_request_settings for key, value in data.items(): self.assertEqual(getattr(advisor_request_settings, key), value)
def test_add_participant_to_team(self, mock_request, mock_email): # PREPARE DATA self.project.refresh_from_db() self.init_mock(mock_request) self.project.set_status(self.project.created_by, settings.PROJECT_CH_STATUS_WAITING) user = self.get_user() request_mock_account.add_mock(user, is_consultant=False, is_superuser=False) email = faker.email() models.Participant.objects.create(user=user, email=email) data = { 'name': faker.name(), 'email': email, 'teams': self.project.teams.all().values_list('pk', flat=True) } url = reverse('api:project-participant-list', kwargs={'project_pk': self.project.pk}) self.setup_credentials(self.super_user) # DO ACTION response = self.client.post(url, data=data) # ASSERTS self.assertTrue(status.is_success(response.status_code)) self.assertTrue(mock_email.called) self.assertEqual(mock_email.call_count, self.project.teams.count() * 2) # one for project and other for team
def init_project(cls): head_coach_role = cls.project.project_roles.get( code=settings.EXO_ROLE_CODE_SPRINT_HEAD_COACH) coach_role = cls.project.project_roles.get( code=settings.EXO_ROLE_CODE_SPRINT_COACH) user_hc = cls.get_user(cls) request_mock_account.add_mock(user_hc, is_consultant=False, is_superuser=False) models.UserProjectRole.objects.create(project_role=head_coach_role, user=user_hc) user_coach = cls.get_user(cls) request_mock_account.add_mock(user_coach, is_consultant=False, is_superuser=False) models.UserProjectRole.objects.create(project_role=coach_role, teams=cls.project.teams.all(), user=user_coach) users_participants = [] for team in cls.project.teams.all(): user_role = models.UserProjectRole.objects.create_participant( project=cls.project, teams=[team], name=faker.name(), email=faker.email()) request_mock_account.add_mock(user_role.user, is_consultant=False, is_superuser=False) users_participants.append(user_role.user) cls.user_coach = user_coach cls.user_hc = user_hc cls.users_participants = users_participants
def setUp(self): self.create_superuser() self.create_user() self.sprint = FakeSprintAutomatedFactory.create( status=settings.PROJECT_CH_PROJECT_STATUS_WAITING) self.team = FakeTeamFactory.create( coach=FakeConsultantFactory.create( user=self.user, status=settings.CONSULTANT_STATUS_CH_ACTIVE, ), project=self.sprint.project_ptr, ) for k in range(3): self.team.add_member(self.super_user, email=faker.email(), name=faker.name()) self.project = self.sprint.project_ptr self.head_role = FakeConsultantProjectRoleFactory.create( project=self.project, consultant=FakeConsultantFactory(user__is_active=True), exo_role=ExORole.objects.get( code=settings.EXO_ROLE_CODE_SPRINT_HEAD_COACH), status=settings.RELATION_ROLE_CH_ACTIVE, ) self.coach_role = self.project.consultants_roles.get( consultant=self.team.coach)
class FakeStepFactory(django.DjangoModelFactory): class Meta: model = Step project = factory.SubFactory('project.faker_factories.FakeProjectFactory') name = factory.LazyAttribute(lambda x: faker.name() + faker.numerify()) index = factory.LazyAttribute(lambda x: random.randint(1, 20))
def test_notification_webhook_url_is_processed_by_send_mail_signal(self, mail_handler_mock): self.create_user() # DO ACTION payment = Payment.objects.create( created_by=self.user, amount=int(faker.numerify()) * 0.01, concept=faker.sentence(), email=faker.email(), full_name=faker.name(), ) # Asserts self.assertTrue(mail_handler_mock.called) called_params = mail_handler_mock.call_args[1] self.assertTrue('notify_webhook' in called_params.keys()) self.assertEqual( called_params.get('notify_webhook'), '{}{}'.format( settings.DOMAIN_NAME, reverse( 'api:email-notify', kwargs={'hash': payment._hash_code} ) ) )
def test_filter_by_user_or_organization(self): # PREPARE DATA name = settings.BRAND_NAME users = FakeUserFactory.create_batch(size=2, is_active=True) customer = FakeCustomerFactory.create() organization = InternalOrganization.objects.get(name=name) for user in users: user.user_permissions.add( Permission.objects.get( codename=settings.PROJECT_PERMS_ADD_PROJECT)) user.user_permissions.add( Permission.objects.get( codename=settings.SPRINT_AUTOMATED_ADD_SPRINT)) organization.users_roles.get_or_create(user=user) FakeSprintAutomatedFactory.create_batch( size=3, created_by=users[0], internal_organization=organization) customer.create_sprint_automated( user_from=users[1], name=faker.name(), description=faker.text(), duration=settings.SPRINT_AUTOMATED_STEPS_COUNT, ) # DO ACTION and ASSERTS for user in users: projects = Project.objects.filter_by_user_or_organization( user).count() self.assertEqual(projects, 4) self.assertEqual( Project.objects.filter_by_user_or_organization( FakeUserFactory.create(is_active=True)).count(), 0)
def test_create_delivery_manager(self): # PREPARE DATA project = FakeProjectFactory.create(status=settings.PROJECT_CH_PROJECT_STATUS_WAITING) project_settings = project.settings project_settings.launch['fix_password'] = '******' project_settings.save() # DO ACTION member = project.add_user_project_delivery_manager( self.super_user, faker.name(), faker.email(), ) # ASSERTS self.assertTrue(member.has_perm( settings.PROJECT_PERMS_VIEW_PROJECT, project, )) self.assertTrue(member.has_perm( settings.PROJECT_PERMS_DELIVERY_MANAGER, project, )) self.assertTrue(member.has_perm( settings.PROJECT_PERMS_PROJECT_MANAGER, project, ))
def test_event_interested_list(self, mock_request): # PREPARE DATA self.init_mock(mock_request) self.setup_credentials(self.super_user) consultant = self.get_user(mock_user=True, is_consultant=True) event = self.create_mommy_event( user=consultant, category_code=settings.EXO_ROLE_CATEGORY_OTHER, ) intereseted_data = { 'name': faker.name(), 'email': faker.email(), 'event': event, } interested = Interested.objects.create(**intereseted_data) # DO ACTION url = reverse('api:event:interested-list', kwargs={'event_id': event.uuid.__str__()}) response = self.client.get(url) # ASSERTS self.assertTrue(status.is_success(response.status_code)) self.assertEqual(len(response.json()), 1) self.assertEqual(response.json()[0].get('name'), interested.name) self.assertEqual(response.json()[0].get('email'), interested.email)
def test_send_mail_without_notify_webhook(self, request_mock): # PREPARE DATA template = 'accounts_change_password' url_reverse = reverse('api:mail-list') params = { 'name': faker.name(), 'public_url': faker.url(), 'recipients': [faker.email()], } data = { 'template': template, 'params': json.dumps(params), 'lang': 'en', } m = MultipartEncoder(fields=data) # DO ACTION with self.settings( EMAIL_BACKEND='mail.backend.StoreBackend', EXOMAILER_STORAGE='django.core.files.storage.FileSystemStorage', EXOMAILER_STORAGE_OPTIONS={}): self.client.post( url_reverse, data=m.to_string(), content_type=m.content_type, ) # ASSERTS self.assertFalse(request_mock.called) self.assertIsNone(request_mock.call_args)
def test_create_request_success(self, mock_request, mock_email): # PREPARE DATA self.init_mock(mock_request) token = _build_jwt(self.user) self.client.credentials(HTTP_AUTHORIZATION='Bearer ' + token) data = { 'concept': faker.sentence(), 'amount': Decimal(10.2).quantize(Decimal('.01'), rounding=ROUND_DOWN), 'currency': settings.PAYMENTS_CH_USD, 'email': faker.email(), 'full_name': faker.name(), } secret_key = settings.PAYMENT_SECRET_KEY dig = hmac.new( secret_key.encode(), msg=str(data).encode(), digestmod=hashlib.sha256).digest() data['token'] = base64.b64encode(dig).decode() data['url'] = faker.uri() url = reverse('api:do-request') # DO ACTION response = self.client.post(url, data=data) # ASSERTS self.assertTrue(status.is_success(response.status_code)) self.assertTrue(mock_email.called) self.assertEqual(models.Payment.objects.count(), 1) payment = models.Payment.objects.first() self.assertEqual( payment.url_notification, data['url']) self.assertEqual( payment.created_by, self.user)
def test_accept_profile_user_optionals(self): # PREPARE DATA consultant, invitation = self.create_validation_agreement( settings.CONSULTANT_VALIDATION_BASIC_PROFILE, ) self.client.login( username=consultant.user.email, password='******', ) url = reverse( 'api:invitation:invitation-accept', kwargs={'hash': invitation.hash}, ) location_granada = 'Granada, Spain' place_id_granada = 'ChIJfcIyLeb8cQ0Rcg1g0533WJI' data = { 'profilePicture': '', 'shortName': faker.first_name(), 'fullName': faker.name(), 'location': location_granada, 'placeId': place_id_granada, } # DO ACTION response = self.client.post(url, data=data, format='json') # ASSERTS self.assertTrue(status.is_success(response.status_code)) invitation.refresh_from_db() self.assertTrue(invitation.is_active) consultant.refresh_from_db() user = consultant.user user.refresh_from_db() self.assertIsNotNone(user.profile_picture) self.assertIsNotNone(user.timezone)
def initialize_team_users(self): team = self.project.teams.first() users = [{ 'name': faker.name(), 'email': faker.email() } for _ in range(TOTAL_PARTICIPANTS)] for user in users: user_data = { 'name': user['name'], 'email': user['email'], 'team': team, 'project': self.project } UserProjectRole.objects.create_participant(**user_data) for _ in range(TOTAL_COACH): user = self.get_user() request_mock_account.add_mock(user, is_consultant=False, is_superuser=False) user_data = { 'user': user, 'project_role': self.project.project_roles.get( code=settings.EXO_ROLE_CODE_SPRINT_COACH), 'team': team, } UserProjectRole.objects.create(**user_data) return team
def test_add_participant_with_uuid(self, mock_request): # PREPARE DATA self.init_mock(mock_request) self.setup_credentials(self.super_user) user = User() request_mock_account.add_mock(user, is_consultant=True, is_superuser=False) data = { 'uuid': user.uuid.__str__(), 'full_name': faker.name(), 'email': faker.email(), 'exo_role': settings.EXO_ROLE_CODE_SUMMIT_SPEAKER } url = reverse('api:event:participant-list', kwargs={'event_id': self.event.uuid.__str__()}) # DO ACTION response = self.client.post(url, data=data, format='json') # ASSERTS self.assertTrue(status.is_success(response.status_code)) self.assertEqual(self.event.participants.count(), 1) participant = self.event.participants.first() self.assertEqual(participant.user.uuid, user.uuid) self.assertTrue(participant.is_speaker)
def test_add_participant(self, mock_request): # PREPARE DATA team = self.initialize_team_users() user_data = { 'name': faker.name(), 'email': faker.email(), 'project': self.project } user_project_role = UserProjectRole.objects.create_participant( **user_data) data = { 'user': user_project_role.user.uuid.__str__(), 'team_role': settings.EXO_ROLE_CODE_SPRINT_PARTICIPANT } url = reverse('api:project-team-add-user', kwargs={ 'project_pk': self.project.pk, 'pk': team.pk }) self.setup_credentials(self.super_user) # DO ACTION response = self.client.post(url, data=data) # ASSERTS self.assertTrue(status.is_success(response.status_code)) data = response.json() self.assertEqual(team.participants.count(), TOTAL_PARTICIPANTS + 1) self.assertEqual(team.members.count(), TOTAL_USERS + 1)