Skip to content

Commit f59b713

Browse files
committed
test(security): mock verified private Hub visibility in egress tests
1 parent 908ae4b commit f59b713

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎tests/test_p0_phi_egress.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,19 @@ def __getitem__(self, key):
6767
def to_pandas(self):
6868
return pd.DataFrame(columns=self.column_names)
6969

70+
# Privacy must also be mocked explicitly; tests must never contact Hub.
71+
class PrivateDatasetInfo:
72+
private = True
73+
74+
class FakeHfApi:
75+
def __init__(self, *args, **kwargs):
76+
pass
77+
78+
def dataset_info(self, *args, **kwargs):
79+
return PrivateDatasetInfo()
80+
81+
monkeypatch.setattr(svc, "HfApi", FakeHfApi, raising=False)
82+
7083
# raising=False: optional HF libraries are not installed in every CI job,
7184
# so inject the module globals that flush_queue() resolves at runtime.
7285
monkeypatch.setattr(svc, "Dataset", fake_dataset, raising=False)

0 commit comments

Comments
 (0)