From 249ec6dc4e0635e2063cfda5b74290243008417f Mon Sep 17 00:00:00 2001 From: 20128094 <20128094@tafe.wa.edu.au> Date: Wed, 20 Nov 2024 23:32:37 +0800 Subject: [PATCH] Refactor(Client_Services): updated the function update_client to be less redundant with handling the parameters of the clients data --- example/list_invoices.py | 1 - myfinances/__pycache__/models.cpython-312.pyc | Bin 2189 -> 2164 bytes .../__pycache__/service.cpython-312.pyc | Bin 3890 -> 4099 bytes myfinances/clients/service.py | 53 ++++++++---------- myfinances/models.py | 1 - .../test_clients.cpython-312-pytest-8.3.3.pyc | Bin 21007 -> 18036 bytes .../test_finance.cpython-312-pytest-8.3.3.pyc | Bin 24873 -> 21167 bytes ...test_receipts.cpython-312-pytest-8.3.3.pyc | Bin 16254 -> 13831 bytes tests/test_clients.py | 13 +---- tests/test_finance.py | 13 ----- tests/test_receipts.py | 10 +--- 11 files changed, 26 insertions(+), 65 deletions(-) delete mode 100644 example/list_invoices.py diff --git a/example/list_invoices.py b/example/list_invoices.py deleted file mode 100644 index b864674..0000000 --- a/example/list_invoices.py +++ /dev/null @@ -1 +0,0 @@ -from myfinances import MyFinancesClient diff --git a/myfinances/__pycache__/models.cpython-312.pyc b/myfinances/__pycache__/models.cpython-312.pyc index 52c504a67e7c7a11b41e5b4ab245e43ac5451fa5..b3bd3cac6a6350b377628ef04e4a8c69ecf334e8 100644 GIT binary patch delta 469 zcmZ{gJxjwt7{_~gZDL~@jWt07br1<66dbDJ+af}t#lfjd3CU3qZSgK0+|(*`aXN6- z-9_;$xOLQ_9Ju)ry102yh9ZIw-0!)2UjN*kGcH;~%QADqR=#)I4=Hw*LCf{gsZ<~S$ZxWG>Hfdblo02KaXrvLx| delta 494 zcmew&&@0G$nwOW00SF$hGE3jMkynC|(Q2|ZyRu9wTPjNmvkg!tg(ZqTl>^9Q1@S6b zG}$IcGs=kGV$V%2E>28O^}EHMoS#>cnpdL9Ik}n9f&CV9aY<2;z~rNhP3kg0Ev*bU zcmHYR4!tc{=N@C|Qt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+C36KeD2u5X#j3C&GQ_@X z)OonNR9&wX>o#nw#~}=a>Zc)nC3jY<>vxyyx?Jd%p}?x7haDP&ttsHzM+h58bfM0! zE#lLtOM7^-Z)>()-mdtx+oc(v8wJjI=2@S1xHQ328Swe-Yd-CCX^N+9;G}0JeR{^F zIc}G>X5DzkGqXNTxHQiTQ*xr;GwuI6azV?93s0N~|ENL-Sz0IT8U2lGY}0&C#^f_f zY|iS#Z`pn8TT9VOyO#xms0Bf({@rCSSrlQ(2ukPo)t#o$r3_>j_t*9w2r6Zw!mzL|%JS6l zwy0DGO6GPKcIHJ)s`GeF-U*t#ia(XTiR(v!Z(wFc5Ah}TC7O#ZVq9w9{)J?&C*Yxf E0pSAAApigX diff --git a/myfinances/clients/service.py b/myfinances/clients/service.py index de2e1de..51b9dab 100644 --- a/myfinances/clients/service.py +++ b/myfinances/clients/service.py @@ -53,6 +53,16 @@ def create_client( return MyFinancesResponse(**response.dict()) def get_client(self, client_id: int) -> MyFinancesResponse[Client]: + """ + Retrieving a singular client via their client_id. + + Args: + client_id (int): The ID of the client to retrieve. + + Returns: + MyFinancesResponse[Client]: Data of the client's details. + + """ response = self._client._get(f"/clients/{client_id}") return MyFinancesResponse(**response.dict()) @@ -62,38 +72,23 @@ def update_client(self, email: Optional[EmailStr] = None, company: Optional[str] = None, contact_method: Optional[str] = None, - is_representative: bool = None, + is_representative: Optional[bool] = None, address: Optional[str] = None, city: Optional[str] = None, country: Optional[str] = None) -> MyFinancesResponse[Client]: - params = {} - - if name is not None: - params["name"] = name - - if phone_number is not None: - params["phone_number"] = phone_number - - if email is not None: - params["email"] = email - - if company is not None: - params["company"] = company - - if contact_method is not None: - params["contact_method"] = contact_method - - if is_representative is not None: - params["is_representative"] = is_representative - - if address is not None: - params["address"] = address - - if city is not None: - params["city"] = city - - if country is not None: - params["country"] = country + params = { + key: value for key, value in{ + "name": name, + "phone_number": phone_number, + "email": email, + "company": company, + "contact_method": contact_method, + "is_representative": is_representative, + "address": address, + "city": city, + "country": country, + }.items() if value is not None + } response = self._client._patch("/clients/update/", json=params) return MyFinancesResponse(**response.dict()) diff --git a/myfinances/models.py b/myfinances/models.py index 8a2a22a..bd7ea07 100644 --- a/myfinances/models.py +++ b/myfinances/models.py @@ -9,7 +9,6 @@ class Meta(BaseModel): success: bool status_code: int - message: str content: dict = None diff --git a/tests/__pycache__/test_clients.cpython-312-pytest-8.3.3.pyc b/tests/__pycache__/test_clients.cpython-312-pytest-8.3.3.pyc index 76878b84e01099bcc66f9c289b4b1f317c6f9852..938178b2eeeb164ebe4a74cd8623bc32e7c8360f 100644 GIT binary patch delta 3318 zcmb_eTWlO>72bdL=H2z|-8<{O?|SWcvc6vm_!2uIZtK|bC6|`8Nj8rEO<2dVt(mnd zhuLl=kdRP9Qk@5?)&c|R1B$7FjQUh6^T0y|5*AcQY^AnuJb;9ol$TN}&KY}c<2s|$|v zQ+#MYi!c0mt0h=-w$^@RHhS!vRR(YLmFW$4>LZ6GWZ5tUK6b-r&fzL;!_@q)>C6W( z<%+^3R}H-A`lay?rVQM6huM8db`4mT1x?@qT+(?M^Ng6KykRwn3&~5hn(YeXA^pPzV~`2(q~ zXnV0(U8t`-Yt@B@ihWPmvWhm%c895Pp5!TL>%DDE?f%zrqrmH6B{&QpNFI1w>SlGg z02#OVx!Q5*;9xSW*FIGf$Hg;VuQ@f>?k2!`Zw78j2?*Dcw8w54>KD!2|;)hulit!-4KWZ)YVgRKNp=`=t%@xYkvw5|Uou19- z<_fAZK%-j>BWsZ0D8UfHlLSu@93%KT!Eu5(L7E^>FheklAo~>;+0_J36R=@OCW4L$ zvPTIfVQSE4IZ5U?Tu6M)GD7AUEGN3{FQD0txB5MJFLBCWVYVl_ht#jPr{SB)GW!es zI&~U0Q=7uuHdJR2KB=qTqOud5>7O$fyp^7p+?pNt(4$o$6?ZA@h0W#?^TNu|lIYu} zu7mq|4Q$Hip!DQLDWK1jzR0}zLFXIPPgcZ}4Z?C$r!}BC@&DAqTbZmF+CEDc5Az5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ohZARXdZaA-UH`4oc_`tE}a9a&RUHgkCrj)Ue2@?7|#FEY$c4o4QFn`_e=8z zAT1w>pRJR2Cd{8p=A8-nqDAI^5dN8PA4>&^4Ch1LqL2D@OP-tx%<+&756kriV-32M zrOZpf1Q{eVBnYS5rle3A2a$%U0#7yW1$*R>94WE+KgR{G`fgX|z3dtNKc1$l!%gr) z#!vh(m+2HEy2HR<(k%v@DKATZNdNK+tdpGpWm=syL7QQ&eY-hXV)LG>uzA#a`$#@F zR!};w1yD7Np`)NQK`xt4UVE~7FPqF_o>CuVav5FSjIP7%&&wgguA@-X;klBe;T1`W zqls%plGGXWG?MDSrz3-pUGR3tR@*T)B+(1Ekw((`+ZI;tG(7(XLask; diff --git a/tests/test_clients.py b/tests/test_clients.py index 6144557..d06ae5f 100644 --- a/tests/test_clients.py +++ b/tests/test_clients.py @@ -34,7 +34,6 @@ def test_create_client(clients_service, mock_client): "meta": { "success": True, "status_code": 200, - "message": "Success" }, "data": {"client_id": 123} } @@ -45,11 +44,10 @@ def test_create_client(clients_service, mock_client): response = clients_service.create_client(**clients_data) - mock_client._post.assert_called_once_with("/clients/create/", clients_data) + mock_client._post.assert_called_once_with("/clients/create/", json=clients_data) assert response.data["client_id"] == 123 assert response.meta.success is True assert response.meta.status_code == 200 - assert response.meta.message == "Success" def test_list_clients(clients_service, mock_client): @@ -66,7 +64,6 @@ def test_list_clients(clients_service, mock_client): "meta": { "success": True, "status_code": 200, - "message": "Success" }, "data": clients_data } @@ -80,7 +77,6 @@ def test_list_clients(clients_service, mock_client): mock_client._get.assert_called_once_with("/clients/", params={}) assert response.meta.success is True assert response.meta.status_code == 200 - assert response.meta.message == "Success" assert isinstance(response.data, list) assert len(response.data) == 2 @@ -105,7 +101,6 @@ def test_client_by_id(clients_service, mock_client): "meta": { "success": True, "status_code": 200, - "message": "Success" }, "data": clients_data } @@ -120,7 +115,6 @@ def test_client_by_id(clients_service, mock_client): mock_client._get.assert_called_once_with(f"/clients/{clients_id}") assert response.meta.success is True assert response.meta.status_code == 200 - assert response.meta.message == "Success" assert response.data["id"] == clients_data["id"] assert response.data["name"] == clients_data["name"] @@ -142,7 +136,6 @@ def test_delete_clients(clients_service, mock_client): "meta": { "success": True, "status_code": 200, - "message": "Success" }, "data": clients_data } @@ -157,7 +150,6 @@ def test_delete_clients(clients_service, mock_client): mock_client._delete.assert_called_once_with(f"/clients/{Client_Id}/delete") assert response.meta.success is True assert response.meta.status_code == 200 - assert response.meta.message == "Success" remaining_clients = [clients for clients in clients_data if clients["id"] == Client_Id] assert len(remaining_clients) == 1 @@ -182,7 +174,6 @@ def test_update_clients_name(clients_service, mock_client): "meta": { "success": True, "status_code": 200, - "message": "Success" }, "data": clients_data } @@ -197,7 +188,6 @@ def test_update_clients_name(clients_service, mock_client): mock_client._patch.assert_called_once_with(f"/clients/update/", json={"name": new_name}) assert response.meta.success is True assert response.meta.status_code == 200 - assert response.meta.message == "Success" # Updated Version updated_clients_data = { @@ -217,7 +207,6 @@ def test_update_clients_name(clients_service, mock_client): "meta": { "success": True, "status_code": 200, - "message": "Success" }, "data": updated_clients_data } diff --git a/tests/test_finance.py b/tests/test_finance.py index da93122..da9137c 100644 --- a/tests/test_finance.py +++ b/tests/test_finance.py @@ -27,7 +27,6 @@ def test_create_invoice(invoices_service, mock_client): "meta": { "success": True, "status_code": 200, - "message": "Successfully created" }, "data": { "invoice_id": 102, @@ -44,7 +43,6 @@ def test_create_invoice(invoices_service, mock_client): assert response.data["invoice_id"] == 102 assert response.meta.success is True assert response.meta.status_code == 200 - assert response.meta.message == "Successfully created" def test_list_invoices(invoices_service, mock_client): @@ -58,7 +56,6 @@ def test_list_invoices(invoices_service, mock_client): "meta": { "success": True, "status_code": 200, - "message": "Successfully fetched invoices" }, "data": invoice_list } @@ -73,7 +70,6 @@ def test_list_invoices(invoices_service, mock_client): assert response.meta.success is True assert response.meta.status_code == 200 - assert response.meta.message == "Successfully fetched invoices" assert isinstance(response.data, list) assert len(response.data) == 2 @@ -93,7 +89,6 @@ def test_delete_invoice(invoices_service, mock_client): "meta": { "success": True, "status_code": 200, - "message": "Successfully deleted invoice" }, "data": invoice_list } @@ -111,7 +106,6 @@ def test_delete_invoice(invoices_service, mock_client): assert response.meta.success is True assert response.meta.status_code == 200 - assert response.meta.message == "Successfully deleted invoice" remaining_invoices = [invoice for invoice in invoice_list if invoice['id'] != invoice_id] @@ -132,7 +126,6 @@ def test_get_invoice(invoices_service, mock_client): "meta": { "success": True, "status_code": 200, - "message": "Successfully deleted invoice" }, "data": invoice_data } @@ -148,7 +141,6 @@ def test_get_invoice(invoices_service, mock_client): assert response.meta.success is True assert response.meta.status_code == 200 - assert response.meta.message == "Successfully deleted invoice" assert response.data["id"] == invoice_data["id"] assert response.data["customer_id"] == invoice_data["customer_id"] @@ -167,7 +159,6 @@ def test_search_invoices_by_id(invoices_service, mock_client): "meta": { "success": True, "status_code": 200, - "message": "Invoices fetched successfully" }, "data": invoice_data } @@ -183,7 +174,6 @@ def test_search_invoices_by_id(invoices_service, mock_client): assert response.meta.success is True assert response.meta.status_code == 200 - assert response.meta.message == "Invoices fetched successfully" assert response.data[1]["id"] == 2 assert response.data[1]["customer_id"] == 124 @@ -203,7 +193,6 @@ def test_update_invoice(invoices_service, mock_client): "meta": { "success": True, "status_code": 200, - "message": "Invoices successfully updated" }, "data": invoice_data } @@ -220,7 +209,6 @@ def test_update_invoice(invoices_service, mock_client): assert response.meta.success is True assert response.meta.status_code == 200 - assert response.meta.message == "Invoices successfully updated" # updated version updated_invoice_data = { @@ -236,7 +224,6 @@ def test_update_invoice(invoices_service, mock_client): "meta": { "success": True, "status_code": 200, - "message": "Invoice fetched successfully" }, "data": updated_invoice_data } diff --git a/tests/test_receipts.py b/tests/test_receipts.py index 75b9a0f..d34af13 100644 --- a/tests/test_receipts.py +++ b/tests/test_receipts.py @@ -3,6 +3,7 @@ from myfinances import MyFinancesClient from myfinances.finance.receipts.service import ReceiptService + @pytest.fixture def mock_client(): mock = Mock(spec=MyFinancesClient) @@ -30,7 +31,6 @@ def test_create_receipt(receipts_service, mock_client): "meta": { "success": True, "status_code": 200, - "message": "Success" }, "data": receipts_data } @@ -44,7 +44,6 @@ def test_create_receipt(receipts_service, mock_client): mock_client._post.assert_called_once_with("/receipts/create/", json=receipts_data) assert response.meta.success is True assert response.meta.status_code == 200 - assert response.meta.message == "Success" assert response.data["name"] == receipts_data["name"] assert response.data["image"] == receipts_data["image"] @@ -62,7 +61,6 @@ def test_list_receipts(receipts_service, mock_client): "meta": { "success": True, "status_code": 200, - "message": "Success" }, "data": list_of_receipts } @@ -71,12 +69,10 @@ def test_list_receipts(receipts_service, mock_client): mock_response.dict.return_value = mock_response_data mock_client._get.return_value = mock_response - response = receipts_service.list_receipts() mock_client._get.assert_called_once_with("/receipts/") assert response.meta.success is True assert response.meta.status_code == 200 - assert response.meta.message == "Success" assert isinstance(response.data, list) assert len(response.data) == 2 @@ -94,7 +90,6 @@ def test_delete_receipt(receipts_service, mock_client): "meta": { "success": True, "status_code": 200, - "message": "Successfully deleted invoice" }, "data": list_of_receipts } @@ -112,7 +107,6 @@ def test_delete_receipt(receipts_service, mock_client): assert response.meta.success is True assert response.meta.status_code == 200 - assert response.meta.message == "Successfully deleted invoice" remaining_receipts = [receipt for receipt in list_of_receipts if receipt["id"] != receipt_id] assert len(remaining_receipts) == 1 @@ -131,7 +125,6 @@ def test_update_receipt(receipts_service, mock_client): "meta": { "success": True, "status_code": 200, - "message": "Success" }, "data": list_of_receipts } @@ -146,6 +139,5 @@ def test_update_receipt(receipts_service, mock_client): assert response.meta.success is True assert response.meta.status_code == 200 - assert response.meta.message == "Success" assert response.data[1]["name"] == search_name