aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJ08nY2025-02-04 16:05:09 +0100
committerJ08nY2025-02-04 16:05:09 +0100
commit5e7ce331e8a1358e68017560e73f9d278f835daa (patch)
treeb6466bef9555c375f3e0f728b5b91e27e4e244d5
parentc7c5947258ceba795ddfca3eec3ce2654cc1097b (diff)
downloadsec-certs-5e7ce331e8a1358e68017560e73f9d278f835daa.tar.gz
sec-certs-5e7ce331e8a1358e68017560e73f9d278f835daa.tar.zst
sec-certs-5e7ce331e8a1358e68017560e73f9d278f835daa.zip
Fix #470.
Bad bad bs4!
-rw-r--r--src/sec_certs/sample/protection_profile.py18
-rw-r--r--tests/cc/test_cc_protection_profiles.py6
2 files changed, 15 insertions, 9 deletions
diff --git a/src/sec_certs/sample/protection_profile.py b/src/sec_certs/sample/protection_profile.py
index 31dedcc2..35eab2dc 100644
--- a/src/sec_certs/sample/protection_profile.py
+++ b/src/sec_certs/sample/protection_profile.py
@@ -156,34 +156,34 @@ class ProtectionProfile(
@staticmethod
def _html_row_get_name(cell: Tag) -> str:
- return cell.find_all("a")[0].string
+ return str(cell.find_all("a")[0].string)
@staticmethod
def _html_row_get_link(cell: Tag) -> str:
- return constants.CC_PORTAL_BASE_URL + cell.find_all("a")[0].get("href")
+ return constants.CC_PORTAL_BASE_URL + str(cell.find_all("a")[0].get("href"))
@staticmethod
def _html_row_get_version(cell: Tag) -> str:
- return cell.text
+ return str(cell.text)
@staticmethod
def _html_row_get_security_level(cell: Tag) -> set[str]:
- return set(cell.stripped_strings)
+ return set(map(str, cell.stripped_strings))
@staticmethod
def _html_row_get_scheme(cell: Tag) -> str | None:
- schemes = list(cell.stripped_strings)
+ schemes = list(map(str, cell.stripped_strings))
return schemes[0] if schemes else None
@staticmethod
def _html_row_get_collaborative_name(cell: Tag) -> str:
- return list(cell.stripped_strings)[0]
+ return list(map(str, cell.stripped_strings))[0]
@staticmethod
def _html_row_get_collaborative_pp_link(cell: Tag) -> str:
- return constants.CC_PORTAL_BASE_URL + [x for x in cell.find_all("a") if x.string == "Protection Profile"][
- 0
- ].get("href")
+ return constants.CC_PORTAL_BASE_URL + str(
+ [x for x in cell.find_all("a") if x.string == "Protection Profile"][0].get("href")
+ )
@dataclass
class InternalState(ComplexSerializableType):
diff --git a/tests/cc/test_cc_protection_profiles.py b/tests/cc/test_cc_protection_profiles.py
index 9bb47564..b8d2e821 100644
--- a/tests/cc/test_cc_protection_profiles.py
+++ b/tests/cc/test_cc_protection_profiles.py
@@ -63,6 +63,12 @@ def test_get_certs_from_web(pp_data_dir: Path, toy_pp_dataset: ProtectionProfile
assert "b02ed76d2545326a" in dset.certs
assert dset == toy_pp_dataset
+ cert = dset["b02ed76d2545326a"]
+ assert isinstance(cert.web_data.name, str)
+ assert isinstance(cert.web_data.status, str)
+ assert isinstance(cert.web_data.category, str)
+ assert isinstance(cert.web_data.version, str)
+
def test_download_and_convert_artifacts(toy_pp_dataset: ProtectionProfileDataset, tmpdir, pp_data_dir):
toy_pp_dataset.copy_dataset(tmpdir)