Skip to content

Commit

Permalink
add beautifulsoup for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
claire-peters committed Aug 23, 2024
1 parent ffd2f86 commit 2ddd916
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
19 changes: 18 additions & 1 deletion coldfront/core/project/tests/test_view_projectdetail.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from bs4 import BeautifulSoup

from coldfront.core.project.tests.test_views import ProjectViewTestBase
from coldfront.core.test_helpers import utils
from coldfront.core.test_helpers.factories import ProjectAttributeFactory
Expand Down Expand Up @@ -90,5 +92,20 @@ def test_projectdetail_addnotification_button_visibility(self):
### Data display tests ###
def test_projectdetail_allocation_table(self):
"""Test ProjectDetail page storage allocation table"""
# pi can see all allocations
# pi can see allocation in Allocations table
response = utils.login_and_get_page(self.client, self.pi_user, self.url)
soup = BeautifulSoup(response.content, 'html.parser')
allocations_table = soup.find('table', {'id': 'invoice_table'})
self.assertIn("holylfs10/tier1", allocations_table.get_text())
# project user belonging to allocation can see allocation
# project user not belonging to allocation can see allocation

def test_projectdetail_allocation_history_table(self):
"""Test ProjectDetail page storage allocation history table"""
# pi can see allocation in Allocations table
response = utils.login_and_get_page(self.client, self.pi_user, self.url)
soup = BeautifulSoup(response.content, 'html.parser')
allocations_table = soup.find('table', {'id': 'allocation_history'})
self.assertIn("holylfs10/tier1", allocations_table.get_text())
# project user belonging to allocation can see allocation
# project user not belonging to allocation can see allocation
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
arrow==1.3.0
asgiref==3.7.2
beautifulsoup4==4.12.3
bibtexparser==1.4.1
blessed==1.20.0
certifi==2024.07.04
Expand Down

0 comments on commit 2ddd916

Please sign in to comment.