channel-app 0.0.153__py3-none-any.whl → 0.0.154__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -60,8 +60,8 @@ class GetOrCreateAddress(OmnitronCommandInterface):
60
60
  data = {
61
61
  "email": address.email[:254],
62
62
  "phone_number": address.phone_number[:128],
63
- "first_name": customer.first_name[:255],
64
- "last_name": customer.last_name[:255],
63
+ "first_name": (address.first_name or customer.first_name)[:255],
64
+ "last_name": (address.last_name or customer.last_name)[:255],
65
65
  "customer": customer.pk,
66
66
  "country": country_pk,
67
67
  "city": city_pk,
@@ -8,10 +8,19 @@ from omnisdk.omnitron.endpoints import (
8
8
  ChannelOrderItemEndpoint,
9
9
  ChannelCancellationRequestEndpoint,
10
10
  ChannelBatchRequestEndpoint)
11
- from omnisdk.omnitron.models import CancellationRequest
12
-
13
- from channel_app.core.data import CancellationRequestDto, CustomerDto, OrderBatchRequestResponseDto
11
+ from omnisdk.omnitron.models import (
12
+ CancellationRequest,
13
+ Customer
14
+ )
15
+
16
+ from channel_app.core.data import (
17
+ AddressDto,
18
+ CancellationRequestDto,
19
+ CustomerDto,
20
+ OrderBatchRequestResponseDto,
21
+ )
14
22
  from channel_app.core.tests import BaseTestCaseMixin
23
+ from channel_app.omnitron.commands.orders.addresses import GetOrCreateAddress
15
24
  from channel_app.omnitron.commands.orders.cargo_companies import GetCargoCompany
16
25
  from channel_app.omnitron.commands.orders.customers import GetOrCreateCustomer
17
26
  from channel_app.omnitron.commands.orders.orders import (
@@ -20,11 +29,12 @@ from channel_app.omnitron.commands.orders.orders import (
20
29
  GetOrderItems,
21
30
  GetOrderItemsWithOrder,
22
31
  ProcessOrderBatchRequests,
23
- ChannelIntegrationActionEndpoint)
32
+ )
24
33
  from channel_app.omnitron.constants import (
25
34
  BatchRequestStatus,
26
35
  CancellationType,
27
- CustomerIdentifierField)
36
+ CustomerIdentifierField
37
+ )
28
38
 
29
39
 
30
40
  class TestProcessOrderBatchRequests(BaseTestCaseMixin):
@@ -338,6 +348,49 @@ class TestGetOrCreateCustomer(BaseTestCaseMixin):
338
348
  self.assertEqual(getattr(customer, key), value)
339
349
 
340
350
 
351
+ class TestGetOrCreateAddress(BaseTestCaseMixin):
352
+ """
353
+ Test case for GetOrCreateAddress
354
+
355
+ run: python -m unittest channel_app.omnitron.commands.tests.test_orders.TestGetOrCreateAddress
356
+ """
357
+
358
+ def setUp(self) -> None:
359
+ self.instance = GetOrCreateAddress(
360
+ integration=self.mock_integration,
361
+ )
362
+ self.instance.objects = {}
363
+ self.instance.objects["address"]: AddressDto = AddressDto(
364
+ email="john.doe@akinon.com",
365
+ phone_number="05556667788",
366
+ first_name="John",
367
+ last_name="Doe",
368
+ country="1",
369
+ city="80",
370
+ line="Hemen sahil kenarı"
371
+ )
372
+ self.instance.objects["customer"]: Customer = Customer(
373
+ pk="1",
374
+ first_name="Customer John",
375
+ last_name="Customer Doe",
376
+ )
377
+
378
+
379
+ @patch.object(GetOrCreateAddress, 'get_location_objects')
380
+ def test_get_data(self, mock_get_location_objects):
381
+ mock_get_location_objects.return_value = (1, 80, None, None)
382
+ data = self.instance.get_data()
383
+
384
+ self.assertEqual(
385
+ data["first_name"],
386
+ self.instance.objects["address"].first_name
387
+ )
388
+ self.assertEqual(
389
+ data["last_name"],
390
+ self.instance.objects["address"].last_name
391
+ )
392
+
393
+
341
394
  class TestGetCargoCompany(BaseTestCaseMixin):
342
395
  """
343
396
  Test case for GetCargoCompany
@@ -1,11 +1,15 @@
1
1
  Metadata-Version: 2.1
2
- Name: channel_app
3
- Version: 0.0.153
2
+ Name: channel-app
3
+ Version: 0.0.154
4
4
  Summary: Channel app for Sales Channels
5
5
  Home-page: https://github.com/akinon/channel_app
6
6
  Author: akinonteam
7
+ License: UNKNOWN
8
+ Platform: UNKNOWN
7
9
  Classifier: Development Status :: 5 - Production/Stable
8
10
  Requires-Python: >=3.5
9
11
  Description-Content-Type: text/markdown
10
12
  Requires-Dist: requests
11
13
 
14
+ UNKNOWN
15
+
@@ -48,17 +48,17 @@ channel_app/omnitron/commands/product_stocks.py,sha256=tX3EpTYg2Y-l7hwZjPYPk_eUm
48
48
  channel_app/omnitron/commands/products.py,sha256=hzEedmOx5GRoPa69Clh5EYqm3Jxi1TuAxhwCngswHmw,32492
49
49
  channel_app/omnitron/commands/setup.py,sha256=dcbvvIFDKKeDVziwR2qWJhVd92IlVLEoYIbMrxKjWDE,35220
50
50
  channel_app/omnitron/commands/orders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
- channel_app/omnitron/commands/orders/addresses.py,sha256=2wjYOyAv5TSZ6c7TUl2SWSFCYg5Vmihimj1Iz4Ybm_U,12566
51
+ channel_app/omnitron/commands/orders/addresses.py,sha256=crk4qwhGYBi6-jnJUQ7M7HloDAvaiGw_d3q40VcSR-E,12613
52
52
  channel_app/omnitron/commands/orders/cargo_companies.py,sha256=Q5RKIbP8cNLRa82GA7TyjrKZ2gIDWXscMTQTSJOvwGE,1386
53
53
  channel_app/omnitron/commands/orders/customers.py,sha256=1IbzZsQSIcroJagsinKy__q3vEU8kZj3LxNhxb-mWQ0,3450
54
54
  channel_app/omnitron/commands/orders/orders.py,sha256=Pv70cBMMs01oU6yvtPk7Xy9zAFd1RfmEtzI30dpliLk,27718
55
55
  channel_app/omnitron/commands/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
56
- channel_app/omnitron/commands/tests/test_orders.py,sha256=acndyE5vpWUYdIaAsa2TlJxxmtUNRKE0IDP7DJRMgTo,20451
56
+ channel_app/omnitron/commands/tests/test_orders.py,sha256=h1UKHTtQNzNP3gtX_nSZYYweyz0CW-lGmN_T0saUUgM,21872
57
57
  channel_app/omnitron/commands/tests/test_product_images.py,sha256=y6tmiJ00kd2GTqSv4MOCjUnXFFSAKhhAwsqQ0l0ccNk,3492
58
58
  channel_app/omnitron/commands/tests/test_product_prices.py,sha256=5HPX9PmjGw6gk3oNrwtWLqdrOkfeNx1mYP-pYwOesZU,3496
59
59
  channel_app/omnitron/commands/tests/test_product_stocks.py,sha256=q4RGlrCNUUJyN5CBL1fzrvdd4Q3xt816mbMRQT0XEd0,3496
60
60
  channel_app/omnitron/commands/tests/test_products.py,sha256=uj5KLaubY3XNu0hidOH-u-Djfboe81Hj7-lP--01Le0,103494
61
- channel_app-0.0.153.dist-info/METADATA,sha256=PycbO9Q7L8ABX4S_eAqQZbKoQUE_GH4LcqQf6AA3hOs,309
62
- channel_app-0.0.153.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
63
- channel_app-0.0.153.dist-info/top_level.txt,sha256=JT-gM6L5Cwxr1xEoN7NHrREDs-d6iGFGfRnK-NrJ3tU,12
64
- channel_app-0.0.153.dist-info/RECORD,,
61
+ channel_app-0.0.154.dist-info/METADATA,sha256=TSTlZzxYP_VJUCmlAJHo2KDZA42IParP8u2V1_6eNUA,353
62
+ channel_app-0.0.154.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
63
+ channel_app-0.0.154.dist-info/top_level.txt,sha256=JT-gM6L5Cwxr1xEoN7NHrREDs-d6iGFGfRnK-NrJ3tU,12
64
+ channel_app-0.0.154.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (73.0.1)
2
+ Generator: bdist_wheel (0.41.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5