Skip to content

Commit

Permalink
try to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Swatinem committed Oct 29, 2024
1 parent 1c9d875 commit 124c78f
Show file tree
Hide file tree
Showing 17 changed files with 409 additions and 132 deletions.
7 changes: 1 addition & 6 deletions services/notification/notifiers/status/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from asgiref.sync import async_to_sync
from shared.config import get_config
from shared.helpers.cache import NO_VALUE, make_hash_sha256
from shared.torngit.base import TorngitBaseAdapter
from shared.torngit.exceptions import TorngitClientError, TorngitError

from helpers.cache import cache
Expand All @@ -22,10 +21,6 @@


class StatusNotifier(AbstractBaseNotifier):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self._repository_service: TorngitBaseAdapter = None

def is_enabled(self) -> bool:
return True

Expand Down Expand Up @@ -139,7 +134,7 @@ def required_builds(self, comparison: ComparisonProxy) -> bool:
return True

def get_github_app_used(self) -> int | None:
torngit = self._repository_service
torngit = self.repository_service
if torngit is None:
return None
torngit_installation = torngit.data.get("installation")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ def test_notify(self, sample_comparison, codecov_vcr, mock_configuration):
notifier_yaml_settings={"layout": "reach, diff, flags, files, footer"},
notifier_site_settings=True,
current_yaml={},
repository_service=comparison.repository_service,
)
result = notifier.notify(comparison)
assert result.notification_attempted
Expand Down Expand Up @@ -425,6 +426,7 @@ def test_notify_test_results_error(
notifier_yaml_settings={"layout": "reach, diff, flags, files, footer"},
notifier_site_settings=True,
current_yaml={},
repository_service=comparison.repository_service,
)
result = notifier.notify(comparison)
assert result.notification_attempted
Expand Down Expand Up @@ -492,6 +494,7 @@ def test_notify_upgrade(
notifier_yaml_settings={"layout": "reach, diff, flags, files, footer"},
notifier_site_settings=True,
current_yaml={},
repository_service=comparison.repository_service,
decoration_type=Decoration.upgrade,
)
result = notifier.notify(comparison)
Expand Down Expand Up @@ -532,6 +535,7 @@ def test_notify_upload_limited(
notifier_yaml_settings={"layout": "reach, diff, flags, files, footer"},
notifier_site_settings=True,
current_yaml={},
repository_service=comparison.repository_service,
decoration_type=Decoration.upload_limit,
)
result = notifier.notify(comparison)
Expand Down Expand Up @@ -570,6 +574,7 @@ def test_notify_gitlab(
notifier_yaml_settings={"layout": "reach, diff, flags, files, footer"},
notifier_site_settings=True,
current_yaml={},
repository_service=comparison.repository_service,
)
result = notifier.notify(comparison)
assert result.notification_attempted
Expand Down Expand Up @@ -635,6 +640,7 @@ def test_notify_new_layout(
},
notifier_site_settings=True,
current_yaml={},
repository_service=comparison.repository_service,
)
result = notifier.notify(comparison)
assert result.notification_attempted
Expand Down Expand Up @@ -710,6 +716,7 @@ def test_notify_with_components(
]
}
},
repository_service=comparison.repository_service,
)
result = notifier.notify(comparison)
assert result.notification_attempted
Expand Down
Loading

0 comments on commit 124c78f

Please sign in to comment.