Skip to content

Commit

Permalink
Fix #597
Browse files Browse the repository at this point in the history
  • Loading branch information
duogenesis committed Jan 5, 2025
1 parent 0ecae9a commit caee4b6
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 16 deletions.
5 changes: 0 additions & 5 deletions service/application/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,6 @@ def get_search_locations(_):
def patch_onboardee_info(req: t.PatchOnboardeeInfo, s: t.SessionInfo):
return person.patch_onboardee_info(req, s)

@adelete('/onboardee-info', expected_onboarding_status=False)
@validate(t.DeleteOnboardeeInfo)
def delete_onboardee_info(req: t.DeleteOnboardeeInfo, s: t.SessionInfo):
return person.delete_onboardee_info(req, s)

@apost('/finish-onboarding', expected_onboarding_status=False)
def post_finish_onboarding(s: t.SessionInfo):
return person.post_finish_onboarding(s)
Expand Down
10 changes: 1 addition & 9 deletions service/person/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,15 +621,6 @@ def patch_onboardee_info(req: t.PatchOnboardeeInfo, s: t.SessionInfo):
else:
return f'Invalid field name {field_name}', 400

def delete_onboardee_info(req: t.DeleteOnboardeeInfo, s: t.SessionInfo):
params = [
dict(email=s.email, position=position)
for position in req.files
]

with api_tx() as tx:
tx.executemany(Q_DELETE_ONBOARDEE_PHOTO, params)

def post_finish_onboarding(s: t.SessionInfo):
api_params = dict(
email=s.email,
Expand Down Expand Up @@ -905,6 +896,7 @@ def delete_profile_info(req: t.DeleteProfileInfo, s: t.SessionInfo):
if files_params:
with api_tx() as tx:
tx.executemany(Q_DELETE_PROFILE_INFO_PHOTO, files_params)
tx.executemany(Q_UPDATE_VERIFICATION_LEVEL, files_params)

if audio_files_params:
with api_tx() as tx:
Expand Down
36 changes: 34 additions & 2 deletions test/functionality1/profile-info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ test_verification_loss_ethnicity () {
where uuid = '$USER_UUID' and not verified_ethnicity")" -eq 1 ]]
}
test_verification_loss_photo () {
test_verification_loss_photo_changed () {
jc PATCH /profile-info \
-d "{
\"base64_file\": {
Expand Down Expand Up @@ -271,6 +271,37 @@ test_verification_loss_photo () {
where uuid = '$USER_UUID' and verification_level_id = 2")" -eq 1 ]]
}
test_verification_loss_photo_removed () {
jc PATCH /profile-info \
-d "{
\"base64_file\": {
\"position\": 1,
\"base64\": \"${img1}\",
\"top\": 0,
\"left\": 0
}
}"
q "update photo set verified = TRUE"
q "
update person
set verified_age = true,
verified_gender = true,
verification_level_id = 3"
[[ "$(q "select COUNT(*) from photo where verified")" -eq 1 ]]
[[ "$(q "
select COUNT(*) from person \
where uuid = '$USER_UUID' and verification_level_id = 3")" -eq 1 ]]
jc DELETE /profile-info -d '{ "files": [1] }'
[[ "$(q "select COUNT(*) from photo where verified")" -eq 0 ]]
[[ "$(q "
select COUNT(*) from person \
where uuid = '$USER_UUID' and verification_level_id = 2")" -eq 1 ]]
}
test_set name "Jeff"
test_set about "I'm a bad ass motherfuckin' DJ / This is why I walk and talk this way"
test_set gender Woman
Expand Down Expand Up @@ -309,4 +340,5 @@ test_theme
test_verification_loss_gender
test_verification_loss_ethnicity
test_verification_loss_photo
test_verification_loss_photo_changed
test_verification_loss_photo_removed

0 comments on commit caee4b6

Please sign in to comment.