Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro-avalos authored and Hook25 committed Nov 8, 2024
1 parent 8d14e88 commit 2d815a9
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions checkbox-ng/plainbox/impl/secure/providers/test_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from plainbox.impl.secure.providers.v1 import Provider1
from plainbox.impl.secure.providers.v1 import Provider1Definition
from plainbox.impl.secure.providers.v1 import Provider1PlugIn
from plainbox.impl.secure.providers.v1 import ProviderContentLoader
from plainbox.impl.secure.providers.v1 import UnitPlugIn
from plainbox.impl.secure.providers.v1 import VersionValidator
from plainbox.impl.secure.rfc822 import FileTextSource
Expand Down Expand Up @@ -911,3 +912,22 @@ def test_init_bindtextdomain__not_called(self, mock_gettext):
base_dir=self.BASE_DIR,
)
self.assertEqual(mock_gettext.bindtextdomain.call_args_list, [])


@mock.patch("plainbox.impl.secure.providers.v1.logger")
class ProviderContentLoaderTests(TestCase):
def test__warn_ignored_file_warned(self, logger_mock):
self_mock = mock.MagicMock()
self_mock.provider.units_dir = "/some/path"
ProviderContentLoader._warn_ignored_file(
self_mock, "/some/path/script.py"
)
self.assertTrue(logger_mock.warning.called)

def test__warn_ignored_file_ignored(self, logger_mock):
self_mock = mock.MagicMock()
self_mock.provider.units_dir = "/some/path"
ProviderContentLoader._warn_ignored_file(
self_mock, "/some/path/__pycache__/script.pyc"
)
self.assertFalse(logger_mock.warning.called)

0 comments on commit 2d815a9

Please sign in to comment.