test application updated@build living space

This commit is contained in:
2024-11-15 19:23:08 +03:00
parent d2cc195ccf
commit 7e1b26f3c4
44 changed files with 261 additions and 321 deletions

View File

@@ -95,7 +95,7 @@ def get_build_living_space_from_json():
read_files = read_files_json.get("build_living_space")
for row in read_files:
pydantic_row = InsertBuildLivingSpace(**row)
with_pydantic.append(pydantic_row.model_dump())
with_pydantic.append(pydantic_row.excluded_dump())
if not with_pydantic:
raise Exception("No data found")
return with_pydantic
@@ -109,12 +109,6 @@ def create_address(requester: BothAPIS, post_code):
print("post_code_response", post_code_response.text)
response_post_code = post_code_response.json()
response_post_code_uu_id = response_post_code["data"]["uu_id"]
requester.local_api.post(
endpoint=f"/postcode/update/{response_post_code_uu_id}",
data={
"is_confirmed": True,
},
)
return response_post_code_uu_id
@@ -212,14 +206,14 @@ def migrate_build_iban(requester: BothAPIS, build_uu_id: str):
def migrate_build_living_space(requester: BothAPIS):
response_datas = get_build_living_space_from_json()
for response_data in response_datas:
print("b response_data[person_uu_id]", response_data["person_uu_id"])
response = requester.local_api.post(
endpoint="/people/list",
data={"page": 1, "size": 1, "query": {"ref_id": response_data.get("person_uu_id")}},
data={"page": 1, "size": 1, "query": {"ref_id": response_data["person_uu_id"]}},
)
print("/people/list response", response.text)
response_data["person_uu_id"] = response.json()["data"][0]["uu_id"]
print("a response_data[person_uu_id]", response_data["person_uu_id"])
response = requester.local_api.post(
endpoint="/building/parts/list",
data={"page": 1, "size": 30, "query": {"ref_id": response_data.get("build_parts_uu_id")}},

View File

@@ -86,6 +86,7 @@
"tax_no" : "",
"id" : 17,
"uu_id" : "cb687f38-91e5-461b-a5b7-53cfe98d5ea1",
"emails" : "caglarcelik8822@gmail.com",
"ref_id" : "71c00e1f-2a3f-4c9d-922d-376647a1ca7f",
"created_at" : "2024-11-06T08:50:09.747Z",
"updated_at" : "2024-11-06T08:50:09.747Z",
@@ -121,6 +122,7 @@
"tax_no" : "",
"id" : 18,
"uu_id" : "2fa2d08e-69e3-4f3a-9104-d32e77411729",
"emails" : "Osmankilinc67@gmail.com",
"ref_id" : "9aa3064e-6db1-4f50-82c9-6130e7312a0c",
"created_at" : "2024-11-06T08:50:09.747Z",
"updated_at" : "2024-11-06T08:50:09.747Z",
@@ -366,6 +368,7 @@
"tax_no" : "",
"id" : 28,
"uu_id" : "0d82e964-80fd-4c80-9f8d-5cac1d7a2f68",
"emails" : "sozdirim@gmail.com",
"ref_id" : "eed3b880-fafa-4546-be39-4d3002c089ab",
"created_at" : "2024-11-06T08:50:09.747Z",
"updated_at" : "2024-11-06T08:50:09.747Z",
@@ -395,6 +398,7 @@
"father_name" : "",
"mother_name" : "",
"country_code" : "TR",
"emails" : "songulvar@gmail.com",
"national_identity_id" : "481b626f-b566-4c9e-9c2e-9fee5db440aa",
"birth_place" : "",
"birth_date" : "1899-12-31T21:00:00.000Z",
@@ -436,6 +440,7 @@
"tax_no" : "",
"id" : 21,
"uu_id" : "36620cc9-eeaa-40e3-885d-e1ab0e8cc7d1",
"emails" : "berat.varnali@turktelekom.com.tr",
"ref_id" : "da53214e-49be-4b07-bc1a-c39c3fe44df1",
"created_at" : "2024-11-06T08:50:09.747Z",
"updated_at" : "2024-11-06T08:50:09.747Z",
@@ -471,6 +476,7 @@
"tax_no" : "",
"id" : 22,
"uu_id" : "ba23bb68-bd82-4022-855a-2c29c23e75a0",
"emails" : "iremyuksekol@gmail.com",
"ref_id" : "e1b9aea6-6787-4304-8a1f-dd712bcbea33",
"created_at" : "2024-11-06T08:50:09.747Z",
"updated_at" : "2024-11-06T08:50:09.747Z",
@@ -540,6 +546,7 @@
"birth_date" : "1899-12-31T21:00:00.000Z",
"tax_no" : "",
"id" : 31,
"emails" : "muberrabaltaci@hotmail.com",
"uu_id" : "312fe4ca-c6ba-47d5-b123-96c6e718e176",
"ref_id" : "a0d3a4e3-3081-43e8-ae71-063f216126e9",
"created_at" : "2024-11-06T08:50:09.747Z",
@@ -611,6 +618,7 @@
"tax_no" : "",
"id" : 33,
"uu_id" : "1ffc8ec9-6cd2-4bd5-bd33-fe29ff13b82f",
"emails" : "fatih707@hotmail.com",
"ref_id" : "41823bea-1b4c-4eb2-ae98-ca50f6af8b2e",
"created_at" : "2024-11-06T08:50:09.747Z",
"updated_at" : "2024-11-06T08:50:09.747Z",
@@ -646,6 +654,7 @@
"tax_no" : "",
"id" : 34,
"uu_id" : "3f700961-30fc-441b-991e-4bba1b360496",
"emails" : "gulsermay@gmail.com",
"ref_id" : "122e627b-c6fe-46ac-b419-c26f5f418630",
"created_at" : "2024-11-06T08:50:09.747Z",
"updated_at" : "2024-11-06T08:50:09.747Z",
@@ -681,6 +690,7 @@
"tax_no" : "",
"id" : 12,
"uu_id" : "92dd0069-4627-44cb-9fa9-7e594ea81be6",
"emails" : "hcihans@gmail.com",
"ref_id" : "1940fb33-1eb6-4163-811b-89940302340a",
"created_at" : "2024-11-06T08:50:09.747Z",
"updated_at" : "2024-11-06T08:50:09.747Z",
@@ -716,6 +726,7 @@
"tax_no" : "",
"id" : 35,
"uu_id" : "b79aa7d7-4b3c-47a4-b71a-8ca9be9c168c",
"emails" : "mustafa_edepli@hotmail.com",
"ref_id" : "280d5b24-33e5-40bb-a278-1a4783f45205",
"created_at" : "2024-11-06T08:50:09.747Z",
"updated_at" : "2024-11-06T08:50:09.747Z",
@@ -751,6 +762,7 @@
"tax_no" : "",
"id" : 36,
"uu_id" : "1a81b4b3-fcc4-4c01-b7d0-f54dc3f7c9a6",
"emails" : "selma.karatay@hotmail.com",
"ref_id" : "2c10f55d-4560-40c3-86f5-aedf38f084b5",
"created_at" : "2024-11-06T08:50:09.747Z",
"updated_at" : "2024-11-06T08:50:09.747Z",
@@ -891,6 +903,7 @@
"tax_no" : "",
"id" : 3,
"uu_id" : "691f73a4-02e4-49c0-a7e5-452232499479",
"emails" : "mehmet.karatay@hotmail.com",
"ref_id" : "d2ae4c73-bcb9-4afe-9473-621f70f649cf",
"created_at" : "2024-11-06T08:50:09.747Z",
"updated_at" : "2024-11-06T08:50:09.747Z",
@@ -921,6 +934,7 @@
"mother_name" : "",
"country_code" : "TR",
"national_identity_id" : "d153bb50-4ce2-4da2-86bd-e5d00fe18d2f",
"emails" : "erinckaratas@gmail.com",
"birth_place" : "",
"birth_date" : "1899-12-31T21:00:00.000Z",
"tax_no" : "",
@@ -961,6 +975,7 @@
"tax_no" : "",
"id" : 13,
"uu_id" : "1ee7244f-6a99-4680-b8d9-880c61270261",
"emails" : "barisgkce@gmail.com",
"ref_id" : "25e89088-ef5d-443f-a151-898e961b68a0",
"created_at" : "2024-11-06T08:50:09.747Z",
"updated_at" : "2024-11-06T08:50:09.747Z",
@@ -1031,6 +1046,7 @@
"tax_no" : "",
"id" : 62,
"uu_id" : "b1dcdb0d-d6a2-41a3-82e9-8ae29749c0d6",
"emails" : "damlaayiker@gmail.com",
"ref_id" : "100940000000015",
"created_at" : "2024-11-06T08:50:09.757Z",
"updated_at" : "2024-11-06T08:50:09.757Z",
@@ -1101,6 +1117,7 @@
"tax_no" : "",
"id" : 37,
"uu_id" : "48c2317d-17a6-4bf3-8798-db97d01f14db",
"emails" : "arisoy2012@gmail.com",
"ref_id" : "1a5d7bdf-f24e-4b9c-91bb-955a09b965f3",
"created_at" : "2024-11-06T08:50:09.747Z",
"updated_at" : "2024-11-06T08:50:09.747Z",
@@ -1276,6 +1293,7 @@
"tax_no" : "",
"id" : 72,
"uu_id" : "4087d0ad-24b7-4e9f-b4fd-065d8c2eb9c4",
"emails" : "sinem@valor.com.tr",
"ref_id" : "100940000000025",
"created_at" : "2024-11-06T08:50:09.757Z",
"updated_at" : "2024-11-06T08:50:09.757Z",
@@ -1346,6 +1364,7 @@
"tax_no" : "",
"id" : 75,
"uu_id" : "ad535cf7-c729-4db3-8051-0ff59ebdbca9",
"emails" : "iletisim@smmmsimsek.com",
"ref_id" : "100940000000028",
"created_at" : "2024-11-06T08:50:09.757Z",
"updated_at" : "2024-11-06T08:50:09.757Z",
@@ -1626,6 +1645,7 @@
"tax_no" : "",
"id" : 84,
"uu_id" : "56618f23-51af-444c-a6f7-87586833a5b4",
"emails" : "fatihedepli@gmail.com",
"ref_id" : "100940000000037",
"created_at" : "2024-11-06T08:50:09.757Z",
"updated_at" : "2024-11-06T08:50:09.757Z",

View File

@@ -13,6 +13,7 @@ def get_people_from_json():
read_files_json, with_pydantic = read_json_file(json_file="people"), []
read_files = read_files_json.get("people")
for row in read_files:
row["ref_id"] = row["uu_id"]
pydantic_row = InsertPerson(**row)
with_pydantic.append(pydantic_row.model_dump())
if not with_pydantic:
@@ -22,6 +23,7 @@ def get_people_from_json():
generate_random_national_identity_id = lambda n: str(random.randint(10 ** (n - 1), 10**n))
def migrate_people(requester: BothAPIS):
for response_data in get_people_from_json():
response_data["national_identity_id"] = generate_random_national_identity_id(11)

View File

@@ -1,6 +1,13 @@
import arrow
from service_app_test.bases import RequestToApi
from service_app_test.api_configs import WagAPI, LocalAPI, BothAPIS
from service_app_test.test_application.evyos.decision_book import run_decision_book_depends
from service_app_test.test_application.evyos.decision_book_items import (
send_invitation_to_building_residents,
collect_invitation_to_building_residents,
assign_people_to_pre_or_wrt
)
from service_app_test.test_application.migrate_old_data.people import migrate_people
from service_app_test.test_application.migrate_old_data.building import (
migrate_build, migrate_build_living_space,
@@ -9,7 +16,7 @@ from service_app_test.test_application.migrate_old_data.company import migrate_c
from service_app_test.test_application.migrate_old_data.accounts import migrate_account_records
password_token = ""
password_token = "CDWs5ASBD4LVbmhNeilKSqBLKjKKt0odOL9h6NY082xqwln7Bo1opvC12j07iP8Gx-vpJSpF5nqUWs-Q9klQUJ6uLc8vuPmVKYVCXE0nz2yU_xyFGOrlqrVro1FSZG1EXwWopuLA_gKH5qkiiQwI1tM3UDFLJjbnR4xjwnH4m6RHe0gYKOZbpkd-uxFxzYbw"
login_data = {
"domain": "evyos.com.tr",
"access_key": "karatay.berkay.sup@evyos.com.tr",
@@ -25,6 +32,29 @@ login_data_wag = {
"password_token": "",
}
login_creds_employee = {
"domain": "evyos.com.tr",
"access_key": "karatay.berkay.sup@evyos.com.tr",
"password": "string",
"remember_me": False,
"password_token": "z5nPguDu6PrY_94KlTGxGBCMcK6rZcDl5AGqO5aHWY7TcQF8LJGYikMQs9labvqdz5yM7vE_f8Zq_vqp00o3EnWwWCWhel-EsMcAujBKNRjV3jC_4xk0_1r_unIYogWAjz_spZipX6pncsch2ngvv0dpx4lHSiZ5QrDTA1RefQ",
}
access_key_president = "bmanco@example.net"
login_creds_occupant = {
"domain": "evyos.com.tr",
"access_key": access_key_president,
"password": "string",
"remember_me": False,
"password_token": "o_2Y_yXS-cl6MxLbzLrXQetXTlDLD3UBDTQNa_mBMyzSOVIgx3LGbnufLRJjd4g6BWFbwVgJIUxbK-Pi0R5dwxfVJKyoEeDdej40uRHSsElKR16nvnqgFB_BJ4nmyN0KSunZHra5NqHJor17EGExOSmlttZV5dC7vFsrc-GUkg",
}
wrt_creds_occupant = {
"domain": "evyos.com.tr",
"access_key": access_key_president,
"password": "string",
"remember_me": False,
"password_token": "",
}
wag_api = RequestToApi()
wag_api.overwrite_base_url(base_url=WagAPI.base_url)
wag_api.selected_object = wag_api.login_via_email_and_password(
@@ -34,16 +64,81 @@ wag_api.selected_object = wag_api.login_via_email_and_password(
local_api = RequestToApi()
local_api.overwrite_base_url(base_url=LocalAPI.base_url)
local_api.selected_object = local_api.login_via_email_and_password(
login_data=login_data, is_password_valid=True
login_data=login_data, is_password_valid=False
)
both_apis = BothAPIS()
both_apis.wag_api = wag_api
both_apis.local_api = local_api
# migrate_company(requester=both_apis)
# migrate_people(requester=both_apis)
# migrate_build(requester=both_apis)
migrate_build_living_space(requester=both_apis)
do_migrates = False
assign_people_to_create_item = -1
# migrate_account_records(requester=both_apis)
# selection_list = None
selection_list = []
# selection_list = None
manager_token = ""
writers_token = manager_token
people_uu_id_list = []
list_of_attendees = []
if do_migrates:
migrate_company(requester=both_apis)
migrate_people(requester=both_apis)
migrate_build(requester=both_apis)
migrate_build_living_space(requester=both_apis)
migrate_account_records(requester=both_apis)
if assign_people_to_create_item == 0:
# local_api.post(
# endpoint="/building/living_space/create",
# data=dict(
# build_parts_uu_id="b23d32d2-e80c-4ca4-8d4a-bae6f710608c",
# person_uu_id="cf47be44-ec58-4585-be41-178160be5b7e",
# occupant_type_uu_id="30512a47-1b3e-4602-ac1a-75fcabb076b4",
# expiry_starts=arrow.now().date().__str__(),
# )
# )
local_api.selected_object = local_api.login_via_email_and_password(
login_data=login_creds_occupant,
is_password_valid=False,
selection_list=selection_list,
)
selected_decision_book_uu_id = run_decision_book_depends(requester=both_apis.local_api)
send_invitation = {
"build_decision_book_uu_id": selected_decision_book_uu_id,
"message": "Request for a Regular Building Meeting",
"planned_date": arrow.now().shift(days=2).date().__str__(),
}
send_invitation_to_building_residents(
send_invitation_dict=send_invitation, requester=both_apis.local_api
)
if assign_people_to_create_item == 1:
count = 17
list_of_attendees.insert(0, manager_token)
collect_invitation_to_building_residents(
attended_dict_list=list_of_attendees, attend_count=count + 1,
requester=both_apis.local_api
)
elif assign_people_to_create_item == 2:
assign_people_to_pre_or_wrt(
person_uu_id=people_uu_id_list[0],
manager_token=manager_token,
occupant_code="MT-VPR",
requester=both_apis.local_api
)
assign_people_to_pre_or_wrt(
person_uu_id=people_uu_id_list[1],
manager_token=manager_token,
occupant_code="MT-WRT",
requester=both_apis.local_api
)
assign_people_to_pre_or_wrt(
person_uu_id=people_uu_id_list[2],
manager_token=manager_token,
occupant_code="MT-PRS",
requester=both_apis.local_api
)