def test_load_master_key_provider_unknown_name(monkeypatch): master_key_parsing._entry_points() monkeypatch.setattr(master_key_parsing, "_ENTRY_POINTS", defaultdict(dict)) with pytest.raises(BadUserArgumentError) as excinfo: master_key_parsing._load_master_key_provider("unknown_name") excinfo.match(r'Requested master key provider not found: "unknown_name"')
def test_entry_points_multiple_per_name(entry_points_cleaner, patch_iter_entry_points): entry_point_a = FakeEntryPoint(name="aws-kms", dist=MagicMock(project_name="aws-encryption-sdk-cli")) entry_point_b = FakeEntryPoint(name="aws-kms", dist=MagicMock(project_name="some-other-thing")) entry_point_c = FakeEntryPoint(name="zzz", dist=MagicMock(project_name="yet-another-thing")) patch_iter_entry_points.return_value = [entry_point_a, entry_point_b, entry_point_c] test = master_key_parsing._entry_points() assert dict(test) == { "aws-kms": {"aws-encryption-sdk-cli": entry_point_a, "some-other-thing": entry_point_b}, "zzz": {"yet-another-thing": entry_point_c}, }
def test_entry_points(monkeypatch): monkeypatch.setattr(master_key_parsing, "_ENTRY_POINTS", defaultdict(dict)) test = master_key_parsing._entry_points() assert test == master_key_parsing._ENTRY_POINTS
def test_entry_points_aws_kms(): assert master_key_parsing._entry_points()["aws-kms"][ "aws-encryption-sdk-cli"].load() is aws_kms_master_key_provider