Skip to content

Commit

Permalink
Merge branch 'develop' into geo-api-search-and-filter
Browse files Browse the repository at this point in the history
  • Loading branch information
pkujawa authored Nov 4, 2024
2 parents 9c36830 + 0bc1efe commit ef77baa
Show file tree
Hide file tree
Showing 53 changed files with 1,504 additions and 1,041 deletions.
2 changes: 1 addition & 1 deletion .github/helpers/.env-selenium
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
REDIS_INSTANCE=redis:6379
PYTHONUNBUFFERED=1
SECRET_KEY=secretkey
ENV=dev
DEBUG=true
CELERY_BROKER_URL=redis://redis:6379/0
CELERY_RESULT_BACKEND=redis://redis:6379/0
CACHE_LOCATION=redis://redis:6379/1
CONSTANCE_REDIS_CONNECTION=redis://redis:6379/0
DATABASE_URL=postgis://postgres:postgres@db:5432/postgres
USE_DUMMY_EXCHANGE_RATES=yes
CELERY_TASK_ALWAYS_EAGER=true
3 changes: 2 additions & 1 deletion .github/helpers/.env-unit
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ KOBO_KF_URL=https://kobo.humanitarianresponse.info
KOBO_KC_URL=https://kobo.humanitarianresponse.info
KOBO_MASTER_API_TOKEN=token
EXCHANGE_RATES_API_KEY=token
REDIS_INSTANCE=redis:6379
CACHE_LOCATION=redis://redis:6379/1
CONSTANCE_REDIS_CONNECTION=redis://redis:6379/0
PYTHONUNBUFFERED=1
2 changes: 1 addition & 1 deletion .github/helpers/docker-compose.selenium.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ services:
- backend-web-app:/tmp/
command: |
sh -c "
cp -r /packages/__pypackages__/3.11/lib/hct_mis_api/apps/web/* /tmp/
cp -r /packages/__pypackages__/3.12/lib/hct_mis_api/apps/web/* /tmp/
"
restart: "no"

Expand Down
5 changes: 0 additions & 5 deletions cypress/package.json

This file was deleted.

402 changes: 0 additions & 402 deletions cypress/yarn.lock

This file was deleted.

6 changes: 5 additions & 1 deletion development_tools/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ DATAMART_URL=https://datamart.unicef.io
EXCHANGE_RATES_API_KEY=
ADMIN_PANEL_URL=unicorn
ROOT_ACCESS_TOKEN=test
CELERY_BROKER_URL="redis://redis:6379/0"
CELERY_BROKER_URL=redis://redis:6379/0
CELERY_RESULT_BACKEND=redis://redis:6379/0
CONSTANCE_REDIS_CONNECTION=redis://redis:6379/0
CACHE_LOCATION=redis://redis:6379/1

PROFILING=off
USE_DUMMY_EXCHANGE_RATES=no
OPENAPI_URL=127.0.0.1:8080/api/rest/
Expand Down
8 changes: 0 additions & 8 deletions development_tools/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ services:
env_file:
- .env
environment:
- REDIS_INSTANCE=redis:6379
- PYTHONUNBUFFERED=1
build:
context: ..
Expand Down Expand Up @@ -61,8 +60,6 @@ services:
image: unicef/hct-mis-backend
env_file:
- .env
environment:
- REDIS_INSTANCE=redis:6379
volumes:
- ../src:/code/
- backend-data:/data
Expand Down Expand Up @@ -90,8 +87,6 @@ services:
image: unicef/hct-mis-backend
env_file:
- .env
environment:
- REDIS_INSTANCE=redis:6379
volumes:
- ../src:/code/
- backend-data:/data
Expand Down Expand Up @@ -186,9 +181,6 @@ services:
ports:
- "5555:5555"
environment:
- REDIS_INSTANCE=redis:6379
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
- PYTHONUNBUFFERED=1
depends_on:
- celery-worker
Expand Down
3 changes: 1 addition & 2 deletions development_tools/local_selenium_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ export KOBO_KF_URL=https://kobo.humanitarianresponse.info
export KOBO_KC_URL=https://kobo.humanitarianresponse.info
export ADMIN_PANEL_URL=unicorn
export PROFILING=off
export CYPRESS_TESTING=yes
export DJANGO_ALLOWED_HOST=localhost
export HCT_MIS_FRONTEND_HOST=localhost:8080
export REDIS_INSTANCE=localhost:6379
export PYTHONUNBUFFERED=1
export CELERY_BROKER_URL=redis://localhost:6379/0
export CELERY_RESULT_BACKEND=redis://localhost:6379/0
export CONSTANCE_REDIS_CONNECTION=redis://localhost:6379/0
export CACHE_LOCATION=redis://localhost:6379/1
export USE_DUMMY_EXCHANGE_RATES=yes
export ELASTICSEARCH_HOST=http://localhost:9200
Expand Down
7 changes: 4 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ FROM curl as certs
RUN curl -o /data/psql-cert.crt -L https://dl.cacerts.digicert.com/DigiCertGlobalRootCA.crt.pem

# Base image
FROM python:3.11.7-slim-bookworm as base
FROM python:3.12.7-slim-bookworm as base

ARG UID=82

Expand Down Expand Up @@ -42,7 +42,7 @@ RUN apt-get update \
ENV PDM_PACKAGES=/packages
ENV CODE=/code
ENV PDM_PROJECT=$PDM_PACKAGES
ENV PYPACKAGES=$PDM_PACKAGES/__pypackages__/3.11
ENV PYPACKAGES=$PDM_PACKAGES/__pypackages__/3.12
ENV PYTHONPYCACHEPREFIX=/tmp/pycache \
PYTHONPATH=$PYPACKAGES/lib:$PYTHONPATH \
PATH=$PYPACKAGES/bin:$PATH \
Expand All @@ -55,7 +55,8 @@ COPY --from=waitforit /data/waitforit /usr/local/bin/waitforit
# Dist builder image
FROM base as pdm
RUN pip install --upgrade pip &&\
pip install pdm==2.15.2 &&\
pip install pdm==2.19.2 &&\
pip install pdm-backend &&\
pip install setuptools==71.1.0 &&\
pdm config cache_dir /var/cache/pdm &&\
pdm config python.use_venv false &&\
Expand Down
754 changes: 361 additions & 393 deletions pdm.lock

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exclude = '''
'''
# TODO: remove migrations exclude rule once it won't create much conflicts between feature branches and develop
[tool.isort]
py_version = 39
py_version = 312
profile = "black"
default_section = "THIRDPARTY"
known_first_party = [
Expand All @@ -48,7 +48,7 @@ include_trailing_comma = true
skip = ["migrations", "snapshots", "venv", ".venv", "__pypackages__", "frontend"]

[tool.mypy]
python_version = 3.11
python_version = 3.12
show_error_codes = true
exclude = [
"migrations",
Expand Down Expand Up @@ -137,7 +137,7 @@ distribution = true

[project]
name = "hope"
version = "2.12.0"
version = "2.13.0"
description = "HCT MIS is UNICEF's humanitarian cash transfer platform."
authors = [
{ name = "Tivix" },
Expand Down Expand Up @@ -190,6 +190,7 @@ dependencies = [
"django-reversion<6.0.0,>=5.0.2",
"django-silk<6.0.0,>=5.0.1",
"django-smart-admin<3,>=2",
"django-smart-env",
"django-sql-explorer[xls]<4,>=3",
"django-storages[azure]<2.0.0,>=1.12.3",
"django-strategy-field<4.0,>=3.0",
Expand Down Expand Up @@ -239,7 +240,7 @@ dependencies = [
"flower>=2.0.1",
"factory-boy<4,>=3",
]
requires-python = "==3.11.*"
requires-python = "==3.12.*"
readme = "README.md"
license = { text = "None" }

Expand Down
2 changes: 1 addition & 1 deletion src/frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "2.12.0",
"version": "2.12.1",
"private": true,
"type": "module",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export function PaymentGrievanceDetails({
{canApprovePaymentVerification &&
ticket.status === GRIEVANCE_TICKET_STATES.FOR_APPROVAL ? (
<Button
data-cy="grievance-approve"
onClick={() =>
confirm({
title: t('Approve'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ exports[`components/grievances/PaymentGrievanceDetails should render with data 1
</h6>
<button
class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButton-colorPrimary MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButton-colorPrimary css-dl1jos-MuiButtonBase-root-MuiButton-root"
data-cy="grievance-approve"
tabindex="0"
type="button"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export function VerifyPaymentGrievance({
<Button
color="primary"
variant="contained"
data-cy="grievance-verify"
onClick={() => setVerifyManualDialogOpen(true)}
>
{t('Verify')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ exports[`components/grievances/VerifyPaymentGrievance should render with data 1`
>
<button
class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButton-colorPrimary MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButton-colorPrimary css-dl1jos-MuiButtonBase-root-MuiButton-root"
data-cy="grievance-verify"
tabindex="0"
type="button"
>
Expand Down
19 changes: 10 additions & 9 deletions src/frontend/src/components/payments/CreateVerificationPlan.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ export const CreateVerificationPlan = ({
variant="fullWidth"
aria-label="full width tabs example"
>
<Tab label={t('FULL LIST')} />
<Tab label={t('RANDOM SAMPLING')} />
<Tab data-cy="tab-full-list" label={t('FULL LIST')} />
<Tab data-cy="tab-random-sampling" label={t('RANDOM SAMPLING')} />
</StyledTabs>
</TabsContainer>
<TabPanel value={selectedTab} index={0}>
Expand Down Expand Up @@ -340,10 +340,11 @@ export const CreateVerificationPlan = ({
name="verificationChannel"
label={t('Verification Channel')}
style={{ flexDirection: 'row' }}
data-cy="checkbox-verification-channel"
choices={[
{ value: 'RAPIDPRO', name: 'RAPIDPRO' },
{ value: 'XLSX', name: 'XLSX' },
{ value: 'MANUAL', name: 'MANUAL' },
{ value: 'RAPIDPRO', name: 'RAPIDPRO', dataCy: 'radio-rapidpro' },
{ value: 'XLSX', name: 'XLSX', dataCy: 'radio-xlsx' },
{ value: 'MANUAL', name: 'MANUAL', dataCy: 'radio-manual' },
]}
component={FormikRadioGroup}
alignItems="center"
Expand Down Expand Up @@ -480,9 +481,9 @@ export const CreateVerificationPlan = ({
style={{ flexDirection: 'row' }}
alignItems="center"
choices={[
{ value: 'RAPIDPRO', name: 'RAPIDPRO' },
{ value: 'XLSX', name: 'XLSX' },
{ value: 'MANUAL', name: 'MANUAL' },
{ value: 'RAPIDPRO', name: 'RAPIDPRO', dataCy: 'radio-rapidpro' },
{ value: 'XLSX', name: 'XLSX', dataCy: 'radio-xlsx' },
{ value: 'MANUAL', name: 'MANUAL', dataCy: 'radio-manual' },
]}
component={FormikRadioGroup}
/>
Expand All @@ -508,7 +509,7 @@ export const CreateVerificationPlan = ({
</DialogContent>
<DialogFooter>
<DialogActions>
<Button onClick={() => setOpen(false)}>CANCEL</Button>
<Button data-cy="button-cancel" onClick={() => setOpen(false)}>CANCEL</Button>
<LoadingButton
loading={loading}
type="submit"
Expand Down
16 changes: 8 additions & 8 deletions src/frontend/src/components/payments/EditVerificationPlan.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ export const EditVerificationPlan = ({
variant="fullWidth"
aria-label="full width tabs example"
>
<Tab label={t('FULL LIST')} />
<Tab label={t('RANDOM SAMPLING')} />
<Tab data-cy="tab-full-list" label={t('FULL LIST')} />
<Tab data-cy="tab-random-sampling" label={t('RANDOM SAMPLING')} />
</StyledTabs>
</TabsContainer>
<TabPanel value={selectedTab} index={0}>
Expand Down Expand Up @@ -351,9 +351,9 @@ export const EditVerificationPlan = ({
label={t('Verification Channel')}
style={{ flexDirection: 'row', alignItems: 'center' }}
choices={[
{ value: 'RAPIDPRO', name: 'RAPIDPRO' },
{ value: 'XLSX', name: 'XLSX' },
{ value: 'MANUAL', name: 'MANUAL' },
{ value: 'RAPIDPRO', name: 'RAPIDPRO', dataCy: 'radio-rapidpro' },
{ value: 'XLSX', name: 'XLSX', dataCy: 'radio-xlsx' },
{ value: 'MANUAL', name: 'MANUAL', dataCy: 'radio-manual' },
]}
component={FormikRadioGroup}
alignItems="center"
Expand Down Expand Up @@ -500,9 +500,9 @@ export const EditVerificationPlan = ({
}}
alignItems="center"
choices={[
{ value: 'RAPIDPRO', name: 'RAPIDPRO' },
{ value: 'XLSX', name: 'XLSX' },
{ value: 'MANUAL', name: 'MANUAL' },
{ value: 'RAPIDPRO', name: 'RAPIDPRO', dataCy: 'radio-rapidpro' },
{ value: 'XLSX', name: 'XLSX', dataCy: 'radio-xlsx' },
{ value: 'MANUAL', name: 'MANUAL', dataCy: 'radio-manual' },
]}
component={FormikRadioGroup}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export function VerificationPlanActions({
color="primary"
variant="outlined"
startIcon={<GetApp />}
data-cy="export-xlsx"
onClick={async () => {
try {
await mutateExport({
Expand Down Expand Up @@ -171,6 +172,7 @@ export function VerificationPlanActions({
<Button
color="primary"
variant="outlined"
data-cy="download-xlsx"
startIcon={<GetApp />}
>
{t('Download Xlsx')}
Expand All @@ -180,7 +182,7 @@ export function VerificationPlanActions({
)}

{canImport && (
<Box p={2}>
<Box p={2} data-cy="import-xlsx">
<ImportXlsx
paymentVerificationPlanId={verificationPlan.id}
cashOrPaymentPlanId={planNode.id}
Expand All @@ -204,6 +206,7 @@ export function VerificationPlanActions({
loading={loadingInvalid}
color="primary"
variant="outlined"
data-cy="button-mark-as-invalid"
onClick={async () => {
try {
await mutateInvalid({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function VerificationPlanDetails({
<Container>
<Box display="flex" alignItems="center" justifyContent="space-between">
<Title>
<Typography variant="h6">
<Typography data-cy={`verification-plan-${verificationPlan.unicefId}`} variant="h6">
{t('Verification Plan')} #{verificationPlan.unicefId}
<AdminButton adminUrl={verificationPlan.adminUrl} sx={{ ml: 2 }} />
</Typography>
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/components/payments/VerifyManual.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ export function VerifyManual({
label="Status"
style={{ flexDirection: 'row' }}
choices={[
{ value: 'RECEIVED', name: t('Received') },
{ value: 'NOT_RECEIVED', name: t('Not Received') },
{ value: 'RECEIVED', name: t('Received'), dataCy: 'choice-received' },
{ value: 'NOT_RECEIVED', name: t('Not Received'), dataCy: 'choice-not-received' },
]}
component={FormikRadioGroup}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ export function FormikRadioGroup({
value: string;
optionLabel?: string | ReactElement;
name: string;
dataCy?: string;
}) => (
<Box p={2} mb={2} key={each.value}>
<Box display="flex" alignItems={alignItems}>
<Radio
color="primary"
value={each.value}
checked={field.value === each.value}
data-cy={each?.dataCy}
/>
{withGreyBox ? (
<GreyBox p={2}>
Expand Down
8 changes: 5 additions & 3 deletions src/hct_mis_api/apps/grievance/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ class Meta:
business_area = factory.LazyAttribute(lambda o: BusinessArea.objects.first())
created_at = factory.Faker("date_time_this_decade", before_now=False, after_now=True, tzinfo=utc)
issue_type = factory.LazyAttribute(
lambda o: factory.fuzzy.FuzzyChoice(list(GrievanceTicket.ISSUE_TYPES_CHOICES.get(o.category, {}).keys())).fuzz()
if GrievanceTicket.ISSUE_TYPES_CHOICES.get(o.category)
else None
lambda o: (
factory.fuzzy.FuzzyChoice(list(GrievanceTicket.ISSUE_TYPES_CHOICES.get(o.category, {}).keys())).fuzz()
if GrievanceTicket.ISSUE_TYPES_CHOICES.get(o.category)
else None
)
)


Expand Down
1 change: 1 addition & 0 deletions src/hct_mis_api/apps/household/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,7 @@ def get_hash_key(self) -> str:
"given_name",
"middle_name",
"family_name",
"full_name",
"sex",
"birth_date",
"phone_no",
Expand Down
Loading

0 comments on commit ef77baa

Please sign in to comment.