Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production v24.25.0 #2276

Merged
merged 6 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ env:
jobs:
test:
uses: ./.github/workflows/reusable-test.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
event_name: ${{ github.event_name }}

build:
needs: test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
make -C ./docs html

- name: Upload sphinx documentation
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: sphinx-docs
path: ./docs/_build/html
Expand Down
22 changes: 19 additions & 3 deletions .github/workflows/reusable-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ name: Test

on:
workflow_call:
secrets:
CODECOV_TOKEN:
required: true
inputs:
event_name:
required: false
type: string
default: 'pull_request'

jobs:
test:
Expand All @@ -12,8 +20,9 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
uses: actions/cache@v3
- name: Restore Docker layers cache
id: cache-restore
uses: actions/cache/restore@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('Pipfile.lock', 'docker/dev.Dockerfile') }}
Expand Down Expand Up @@ -54,7 +63,14 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Move cache
- name: Move new cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

- name: Save Docker layers cache
if: ${{ inputs.event_name == 'push' || github.event_name == 'push' }}
uses: actions/cache/save@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('Pipfile.lock', 'docker/dev.Dockerfile') }}
4 changes: 4 additions & 0 deletions .github/workflows/test-merge-queue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ on:
jobs:
test:
uses: ./.github/workflows/reusable-test.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
event_name: ${{ github.event_name }}
4 changes: 4 additions & 0 deletions .github/workflows/test-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ concurrency:
jobs:
test:
uses: ./.github/workflows/reusable-test.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
event_name: ${{ github.event_name }}
4 changes: 2 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ pydantic = "==1.10.15" # fix for fhir.resources < 7.0.2
pyjwt = "==2.8.0"
python-slugify = "==8.0.4"
pywebpush = "==1.14.0"
redis = { extras = ["hiredis"], version = "==5.0.3" } # constraint for redis-om
redis = { extras = ["hiredis"], version = "==5.0.5" } # constraint for redis-om
redis-om = "==0.3.1"
requests = "==2.32.3"
sentry-sdk = "==2.3.1"
sentry-sdk = "==2.5.1"
whitenoise = "==6.6.0"

[dev-packages]
Expand Down
15 changes: 8 additions & 7 deletions Pipfile.lock

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

2 changes: 1 addition & 1 deletion care/facility/api/serializers/facility.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
facility = self.instance
image = self.validated_data["cover_image"]
image_extension = image.name.rsplit(".", 1)[-1]
config, bucket_name = get_client_config(BucketType.FACILITY, True)
config, bucket_name = get_client_config(BucketType.FACILITY)

Check warning on line 168 in care/facility/api/serializers/facility.py

View check run for this annotation

Codecov / codecov/patch

care/facility/api/serializers/facility.py#L168

Added line #L168 was not covered by tests
s3 = boto3.client("s3", **config)
image_location = f"cover_images/{facility.external_id}_cover.{image_extension}"
s3.put_object(
Expand Down
7 changes: 7 additions & 0 deletions care/facility/tests/test_unlink_district_admins.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,10 @@ def test_unlink_faciltity_admin_different_district(self):
)
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
self.assertEqual(response.json()["detail"], "User not found")

def test_unlink_home_facility_by_nurse(self):
self.client.force_login(self.staff1)
response = self.client.delete(
f"/api/v1/users/{self.staff1.username}/clear_home_facility/"
)
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
5 changes: 5 additions & 0 deletions care/users/api/viewsets/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,11 @@ def clear_home_facility(self, request, *args, **kwargs):
if not user.home_facility:
raise ValidationError({"home_facility": "No Home Facility Present"})
if (
requesting_user.id == user.id
and requesting_user.user_type == User.TYPE_VALUE_MAP["Nurse"]
):
pass
elif (
requesting_user.user_type < User.TYPE_VALUE_MAP["DistrictAdmin"]
or requesting_user.user_type in User.READ_ONLY_TYPES
):
Expand Down