Skip to content

Commit

Permalink
register IntegrityService correctly (#16543)
Browse files Browse the repository at this point in the history
Signed-off-by: William Woodruff <[email protected]>
  • Loading branch information
woodruffw authored Aug 21, 2024
1 parent 5545884 commit 5a39e80
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/unit/attestations/test_init.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import pretend

from warehouse import attestations
from warehouse.attestations.interfaces import IIntegrityService
from warehouse.attestations.services import IntegrityService


def test_includeme():
config = pretend.stub(
register_service_factory=pretend.call_recorder(
lambda factory, iface, name=None: None
),
)

attestations.includeme(config)

assert config.register_service_factory.calls == [
pretend.call(IntegrityService.create_service, IIntegrityService),
]
4 changes: 4 additions & 0 deletions warehouse/attestations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@
"IntegrityService",
"UnsupportedPublisherError",
]


def includeme(config):
config.register_service_factory(IntegrityService.create_service, IIntegrityService)

0 comments on commit 5a39e80

Please sign in to comment.