Skip to content

Commit

Permalink
Merge branch 'main' into feature/tag-incident-commander
Browse files Browse the repository at this point in the history
  • Loading branch information
GabDug authored Sep 27, 2024
2 parents be433d4 + e07e9fc commit f070514
Show file tree
Hide file tree
Showing 33 changed files with 151 additions and 141 deletions.
5 changes: 3 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ PAGERDUTY_ACCOUNT_EMAIL="[email protected]"
PAGERDUTY_API_KEY="u+XXXXXXXXXXXXXXXX-X"
PAGERDUTY_URL="https://api.pagerduty.com"

## SSO settings (optional)
## SSO settings

OIDC_OP_DISCOVERY_DOCUMENT_URL=https://oauth.mycompany.local/auth/realms/realm/.well-known/openid-configuration
OIDC_RP_CLIENT_ID=firefighter-incident
Expand All @@ -98,5 +98,6 @@ RAID_JIRA_PROJECT_KEY="T2"
RAID_TOOLBOX_URL=https://toolbox.mycompany.com/login

FF_SLACK_SKIP_CHECKS=true
# Disable SSO redirect for local dev by setting to true. When SSO is disabled, go to /admin/ to login
# Disable SSO redirect for local dev by setting to true but still need a valid URL in OIDC_OP_DISCOVERY_DOCUMENT_URL.
# When SSO is disabled, go to /admin/ to login
FF_DEBUG_NO_SSO_REDIRECT=false
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup PDM
uses: pdm-project/setup-pdm@v3
uses: pdm-project/setup-pdm@v4
id: setup-pdm
with:
python-version: ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ jobs:
images: ghcr.io/ManoManoTech/firefighter-incident

- name: "Build and push Docker image"
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
- id: fix-byte-order-marker
# Versions must be kept in sync with lockfile
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.4.10'
rev: 'v0.6.8'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# This configuration file is for the **development** setup.
# It will launch Postgres and Redis containers, not the app itself.

version: "3.1"

services:
db:
container_name: ff-db
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/0002-setup-slack-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Check the `.env`.

Read the settings page.

Once Slack is setup, you can remove FF_SKIP_SLACK_CHEKS=true from your `.env` file.
Once Slack is setup, you can remove FF_SLACK_SKIP_CHECKS=true from your `.env` file.

Using the information from the previous part, check your configuration.

Expand Down
37 changes: 19 additions & 18 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ select = ["ALL"]

ignore = [
"A003", # Class attribute is shadowing a python builtin - Too many false positive and no way to exclude (yet?)
"A005", # Module `*` is shadowing a Python builtin module
"ARG001", # XXX Enable later - No way to specify which args to ignore
"ANN", # XXX Enable later - More than 400 annotations errors
"ANN101", # Missing type annotation for `self` in method
Expand All @@ -509,6 +510,10 @@ ignore = [
"D107",
"D401", # First line of docstring should be in imperative mood
"D205", # 1 blank line required between summary line and description
"DOC201", # `return` is not documented in docstring
"DOC402", # `yield` is not documented in docstring
"DOC501", # Raised exception `*` missing from docstring
"DOC502", # Raised exception is not explicitly raised: `*`
"E501", # Line too long
"EM101", # Exceptions should not use a string literal but a variable
"PLR2004", # Too aggressive, but some good points
Expand Down
2 changes: 1 addition & 1 deletion src/firefighter/incidents/models/incident.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ def update_roles(

return incident_update

def create_incident_update( # noqa: PLR0913
def create_incident_update(
self: Incident,
message: str | None = None,
status: int | None = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ <h3 class="flex-auto truncate text-sm font-semibold leading-6 text-neutral-900 d
<p class="mt-2 truncate text-sm text-neutral-500 dark:text-neutral-300">{{impact.impact_level.value_label}}: {{impact.impact_level.name}}</p>
</li>
</ul>
{% empty %}
<div class="px-4 py-5 sm:px-6 col-span-2">
<h4 class="text-center font-medium text-sm text-neutral-500 dark:text-neutral-100">
No impacts defined at the moment.
</h4>
</div>
{% endfor %}
{% endfill %}
{% endcomponent %}
Expand Down
3 changes: 1 addition & 2 deletions src/firefighter/slack/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,7 @@ def save_model(
group_slack_id=obj.usergroup_id
)
elif obj.handle:
if obj.handle.startswith("@"):
obj.handle = obj.handle[1:]
obj.handle = obj.handle.removeprefix("@")
obj.handle.strip()
fetch_obj = UserGroup.objects.fetch_usergroup(group_handle=obj.handle)
if fetch_obj:
Expand Down
2 changes: 1 addition & 1 deletion src/firefighter/slack/signals/incident_updated.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def incident_updated_update_status_handler(
incident=incident,
incident_update=incident_update,
status_changed=bool("_status" in updated_fields),
old_priority=kwargs.get("old_priority", None),
old_priority=kwargs.get("old_priority"),
)


Expand Down
10 changes: 5 additions & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ def _debug(settings: SettingsWrapper) -> None:
template["OPTIONS"]["debug"] = True


@pytest.fixture()
@pytest.fixture
def main_heading() -> str:
"""An example fixture containing some html fragment."""
return '<p class="mt-2 text-sm text-base-content text-opacity-80">Report, manage, escalate!</p>'


@pytest.fixture(scope="session")
def django_db_setup( # noqa: PT004
def django_db_setup(
django_db_setup: Any, django_db_blocker: DjangoDbBlocker
) -> None:
# XXX Allow override of fixtures path
Expand Down Expand Up @@ -76,13 +76,13 @@ def django_db_setup( # noqa: PT004
django_db_blocker.restore()


@pytest.fixture()
@pytest.fixture
def incident() -> Incident:
return IncidentFactory.build()


@pytest.fixture()
@pytest.mark.django_db()
@pytest.fixture
@pytest.mark.django_db
def incident_saved() -> Incident:
incident: Incident = IncidentFactory.build()
incident.component.group.save()
Expand Down
8 changes: 4 additions & 4 deletions tests/test_api/test_api_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_api_schema(client: Client) -> None:
assert response.status_code == 200


@pytest.mark.django_db()
@pytest.mark.django_db
def test_incidents_cost_api(admin_client: Client, admin_user: User) -> None:
"""This test ensures that the incidents costs API endpoint is accessible for an admin"""
admin_client.force_login(admin_user)
Expand All @@ -31,7 +31,7 @@ def test_incidents_cost_api(admin_client: Client, admin_user: User) -> None:
assert response.status_code == 200


@pytest.mark.django_db()
@pytest.mark.django_db
def test_incidents_cost_api_unauthorized(client: Client) -> None:
"""This test ensures that the incidents costs API endpoint is not accessible for a guest user"""
user = UserFactory.create()
Expand All @@ -41,7 +41,7 @@ def test_incidents_cost_api_unauthorized(client: Client) -> None:
assert response.status_code == 403


@pytest.mark.django_db()
@pytest.mark.django_db
def test_incidents_cost_type_api(admin_client: Client, admin_user: User) -> None:
"""This test ensures that the incidents cost types API endpoint is accessible for an admin"""
admin_client.force_login(admin_user)
Expand All @@ -50,7 +50,7 @@ def test_incidents_cost_type_api(admin_client: Client, admin_user: User) -> None
assert response.status_code == 200


@pytest.mark.django_db()
@pytest.mark.django_db
def test_incidents_cost_api_type_unauthorized(client: Client) -> None:
"""This test ensures that the incidents costs API endpoint is not accessible for a guest user"""
user = UserFactory.create()
Expand Down
Loading

0 comments on commit f070514

Please sign in to comment.