diff --git a/coldfront/core/project/tests/test_views.py b/coldfront/core/project/tests/test_views.py index 32c617d75..bd094bbed 100644 --- a/coldfront/core/project/tests/test_views.py +++ b/coldfront/core/project/tests/test_views.py @@ -384,15 +384,14 @@ def test_add_users_form_validation(self): self.client.force_login(self.proj_accessmanager) # Prepare form data for adding a user form_data = { - 'q': 'search_user', - 'search_by': 'username', + 'q': self.nonproj_allocation_user.username, + 'search_by': 'username_only', 'userform-TOTAL_FORMS': '1', 'userform-INITIAL_FORMS': '0', 'userform-MIN_NUM_FORMS': '0', 'userform-MAX_NUM_FORMS': '1', 'userform-0-selected': 'on', 'userform-0-role': ProjectUserRoleChoice.objects.get(name='User').pk, - 'userform-0-username': self.nonproj_allocation_user.username, 'allocationform-allocation': [self.proj_allocation.pk] } response = self.client.post(self.url, data=form_data) diff --git a/coldfront/core/project/views.py b/coldfront/core/project/views.py index 7c7ed6dba..9d54d2ca0 100644 --- a/coldfront/core/project/views.py +++ b/coldfront/core/project/views.py @@ -612,7 +612,6 @@ def post(self, request, *args, **kwargs): allocation_form = ProjectAddUsersToAllocationForm( request.user, project_obj.pk, request.POST, prefix='allocationform' ) - added_users_count = 0 if formset.is_valid() and allocation_form.is_valid(): @@ -672,7 +671,6 @@ def post(self, request, *args, **kwargs): 'status': projuserstatus_active, } ) - added_users_count += 1 for allocation in Allocation.objects.filter( pk__in=allocation_form_data @@ -755,14 +753,13 @@ def get(self, request, *args, **kwargs): signal_response = project_filter_users_to_remove.send( sender=self.__class__, users_to_remove=users_list, project=project_obj ) - print('signal_response', signal_response) if signal_response: user_categories = signal_response[0][1] users_no_removal = user_categories[0] users_to_remove = user_categories[1] else: - users_no_removal = users_list - users_to_remove = [] + users_no_removal = [] + users_to_remove = users_list context = {} diff --git a/coldfront/core/test_helpers/utils.py b/coldfront/core/test_helpers/utils.py index 8ce58c733..fe1c858c0 100644 --- a/coldfront/core/test_helpers/utils.py +++ b/coldfront/core/test_helpers/utils.py @@ -1,5 +1,5 @@ """utility functions for unit and integration testing""" -from beautifulsoup4 import BeautifulSoup +from bs4 import BeautifulSoup def page_contains_for_user(test_case, user, url, text): """Check that page contains text for user"""