Skip to content

Commit

Permalink
Updates to fix unresolved symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathangreen committed Apr 26, 2024
1 parent b1ab61a commit 6b7b6a8
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 69 deletions.
12 changes: 0 additions & 12 deletions bin/custom_list_entry_update_license_pool

This file was deleted.

1 change: 0 additions & 1 deletion src/palace/manager/core/classifier/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import logging
import re
from collections import Counter
from importlib.resources import files

from sqlalchemy.orm.session import Session

Expand Down
10 changes: 6 additions & 4 deletions src/palace/manager/core/metadata_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1856,17 +1856,19 @@ def filter_recommendations(self, _db):
for identifier in self.recommendations:
by_type[identifier.type].append(identifier.identifier)

self.recommendations = []
recommendations = set()

Check warning on line 1859 in src/palace/manager/core/metadata_layer.py

View check run for this annotation

Codecov / codecov/patch

src/palace/manager/core/metadata_layer.py#L1859

Added line #L1859 was not covered by tests
for type, identifiers in list(by_type.items()):
existing_identifiers = (
_db.query(Identifier)
.filter(Identifier.type == type)
.filter(Identifier.identifier.in_(identifiers))
)
self.recommendations += existing_identifiers.all()
recommendations.update(existing_identifiers.all())

Check warning on line 1866 in src/palace/manager/core/metadata_layer.py

View check run for this annotation

Codecov / codecov/patch

src/palace/manager/core/metadata_layer.py#L1866

Added line #L1866 was not covered by tests

if self.primary_identifier in self.recommendations:
self.recommendations.remove(identifier_data)
if self.primary_identifier in recommendations:
recommendations.remove(self.primary_identifier)

Check warning on line 1869 in src/palace/manager/core/metadata_layer.py

View check run for this annotation

Codecov / codecov/patch

src/palace/manager/core/metadata_layer.py#L1869

Added line #L1869 was not covered by tests

self.recommendations = list(recommendations)

Check warning on line 1871 in src/palace/manager/core/metadata_layer.py

View check run for this annotation

Codecov / codecov/patch

src/palace/manager/core/metadata_layer.py#L1871

Added line #L1871 was not covered by tests


class CSVFormatError(csv.Error):
Expand Down
8 changes: 0 additions & 8 deletions src/palace/manager/util/personal_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,6 @@ def is_corporate_name(display_name):
return False


def is_one_name(human_name):
"""Examples: 'Pope Francis', 'Prince'."""
if name.first and not name.last:
return True

return False


def display_name_to_sort_name(display_name):
"""
Take the "First Name Last Name"-formatted display_name, and convert it
Expand Down
Empty file.
8 changes: 0 additions & 8 deletions tests/manager/api/admin/dummy_validator/dummy_validator.py

This file was deleted.

This file was deleted.

27 changes: 0 additions & 27 deletions tests/manager/api/admin/test_validator.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import pytest
from werkzeug.datastructures import MultiDict

import palace.manager.sqlalchemy.util
from palace.manager.api.admin.validator import Validator
from tests.manager.api.admin.dummy_validator.dummy_validator import (
DummyAuthenticationProviderValidator,
)


class MockValidations:
Expand Down Expand Up @@ -249,25 +244,3 @@ def test__is_url(self):
# You can make specific URLs go through even if they
# wouldn't normally pass.
assert True == m("Not a URL", ["Not a URL", "Also not a URL"])


class PatronAuthenticationValidatorFactoryTest:
@pytest.mark.parametrize(
"name,protocol",
[
("validator_using_class_name", "tests.admin.fixtures.dummy_validator"),
(
"validator_using_factory_method",
"tests.admin.fixtures.dummy_validator_factory",
),
],
)
def test_create_can_create(self, name, protocol):
# Arrange
factory = PatronAuthenticationValidatorFactory()

# Act
result = palace.manager.sqlalchemy.util.create(protocol)

# Assert
assert isinstance(result, DummyAuthenticationProviderValidator)
15 changes: 13 additions & 2 deletions tests/manager/core/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,10 +1014,21 @@ def test_filter_recommendations(self, db: DatabaseTransactionFixture):
metadata.filter_recommendations(db.session)
[result] = metadata.recommendations
# The IdentifierData has been replaced by a bonafide Identifier.
assert True == isinstance(result, Identifier)
# The genuwine article.
assert isinstance(result, Identifier)
# The genuine article.
assert known_identifier == result

# Recommendations are filtered to make sure the primary identifier is not recommended.
primary_identifier = db.identifier()
metadata = Metadata(DataSource.OVERDRIVE, primary_identifier=primary_identifier)
metadata.recommendations = [
known_identifier_data,
unknown_identifier,
primary_identifier,
]
metadata.filter_recommendations(db.session)
assert [known_identifier] == metadata.recommendations

def test_metadata_can_be_deepcopied(self):
# Check that we didn't put something in the metadata that
# will prevent it from being copied. (e.g., self.log)
Expand Down

0 comments on commit 6b7b6a8

Please sign in to comment.