def test__get_model__wrong_field(self): field = 'wrong_fk' with pytest.raises(ValueError) as e: PermissionPlugin._get_model(ModelWithMeta, field) assert e.value.args[ 0] == f"No foreign key {field} in mapper {ModelWithMeta.__name__}"
def test__get_model(self): result = PermissionPlugin._get_model(ModelWithMeta, 'related_model_id') assert result is RelatedModel