channel-app 0.0.139__tar.gz → 0.0.140__tar.gz
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.
- {channel_app-0.0.139 → channel_app-0.0.140}/PKG-INFO +2 -4
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/tests/test_products.py +634 -2
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app.egg-info/PKG-INFO +2 -4
- {channel_app-0.0.139 → channel_app-0.0.140}/setup.py +1 -1
- {channel_app-0.0.139 → channel_app-0.0.140}/.gitignore +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/.vscode/settings.json +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/Makefile +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/Procfile-dist +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/README.md +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/akinon.json-dist +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/bitbucket-pipelines.yml +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/build.sh-dist +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/__init__.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/app/__init__.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/app/order/__init__.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/app/order/service.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/app/product/__init__.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/app/product/service.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/app/product_image/__init__.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/app/product_image/service.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/app/product_price/__init__.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/app/product_price/service.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/app/product_stock/__init__.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/app/product_stock/service.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/app/setup/__init__.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/app/setup/service.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/channel/__init__.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/channel/commands/__init__.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/channel/commands/orders/__init__.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/channel/commands/orders/orders.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/channel/commands/product_categories.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/channel/commands/product_images.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/channel/commands/product_prices.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/channel/commands/product_stocks.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/channel/commands/products.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/channel/commands/setup.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/channel/integration.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/core/__init__.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/core/clients.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/core/commands.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/core/data.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/core/integration.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/core/products.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/core/settings.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/core/tests/test_clients.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/core/tests.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/core/utilities.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/__init__.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/batch_request.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/__init__.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/batch_requests.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/error_reports.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/integration_actions.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/orders/__init__.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/orders/addresses.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/orders/cargo_companies.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/orders/customers.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/orders/orders.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/product_categories.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/product_images.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/product_prices.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/product_stocks.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/products.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/setup.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/tests/__init__.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/constants.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/exceptions.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/integration.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app.egg-info/SOURCES.txt +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app.egg-info/dependency_links.txt +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app.egg-info/requires.txt +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/channel_app.egg-info/top_level.txt +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/docs/Makefile +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/docs/make.bat +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/docs/requirements.txt +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/docs/source/architecture.rst +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/docs/source/command_reference.rst +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/docs/source/conf.py +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/docs/source/flows.rst +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/docs/source/images/async.png +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/docs/source/images/batch_request_state_machine.png +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/docs/source/images/sync.png +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/docs/source/index.rst +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/docs/source/installation_and_usage.rst +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/docs/source/terminology.rst +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/requirements-dev.txt +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/requirements.txt +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/setup.cfg +0 -0
- {channel_app-0.0.139 → channel_app-0.0.140}/tox.ini +0 -0
@@ -1,14 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: channel_app
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.140
|
4
4
|
Summary: Channel app for Sales Channels
|
5
5
|
Home-page: https://github.com/akinon/channel_app
|
6
6
|
Author: akinonteam
|
7
7
|
License: UNKNOWN
|
8
|
+
Description: UNKNOWN
|
8
9
|
Platform: UNKNOWN
|
9
10
|
Classifier: Development Status :: 5 - Production/Stable
|
10
11
|
Requires-Python: >=3.5
|
11
12
|
Description-Content-Type: text/markdown
|
12
|
-
|
13
|
-
UNKNOWN
|
14
|
-
|
{channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/tests/test_products.py
RENAMED
@@ -6,16 +6,27 @@ from omnisdk.omnitron.endpoints import (
|
|
6
6
|
ChannelIntegrationActionEndpoint,
|
7
7
|
ChannelProductCategoryEndpoint,
|
8
8
|
ChannelProductEndpoint,
|
9
|
+
ChannelProductPriceEndpoint,
|
9
10
|
ChannelProductStockEndpoint,
|
10
11
|
ChannelExtraProductStockEndpoint,
|
11
12
|
ChannelExtraProductPriceEndpoint
|
12
13
|
)
|
13
|
-
from omnisdk.omnitron.models import
|
14
|
+
from omnisdk.omnitron.models import (
|
15
|
+
ChannelAttributeConfig,
|
16
|
+
ProductStock,
|
17
|
+
ProductPrice
|
18
|
+
)
|
14
19
|
|
15
20
|
from channel_app.core.commands import OmnitronCommandInterface
|
16
21
|
from channel_app.core.tests import BaseTestCaseMixin
|
17
22
|
from channel_app.omnitron.commands.batch_requests import GetBatchRequests
|
18
|
-
from channel_app.omnitron.commands.product_prices import
|
23
|
+
from channel_app.omnitron.commands.product_prices import (
|
24
|
+
GetInsertedProductPrices,
|
25
|
+
GetInsertedProductPricesFromExtraPriceList,
|
26
|
+
GetProductStocksFromProductPrices,
|
27
|
+
GetUpdatedProductPrices,
|
28
|
+
GetUpdatedProductPricesFromExtraPriceList
|
29
|
+
)
|
19
30
|
from channel_app.omnitron.commands.product_stocks import (
|
20
31
|
GetInsertedProductStocks,
|
21
32
|
GetProductPricesFromProductStocks,
|
@@ -1815,3 +1826,624 @@ class TestGetInsertedProductStocksFromExtraStockList(BaseTestCaseMixin):
|
|
1815
1826
|
self.assertEqual(stocks[1].pk, self.integration_actions[1].object_id)
|
1816
1827
|
self.assertEqual(stocks[0].remote_id, self.sample_stocks[0].remote_id)
|
1817
1828
|
self.assertEqual(stocks[1].remote_id, self.sample_stocks[1].remote_id)
|
1829
|
+
|
1830
|
+
|
1831
|
+
class TestGetUpdatedProductPrices(BaseTestCaseMixin):
|
1832
|
+
"""
|
1833
|
+
Test case for GetUpdatedProductPrices
|
1834
|
+
run: python -m unittest channel_app.omnitron.commands.tests.test_products.TestGetUpdatedProductPrices
|
1835
|
+
"""
|
1836
|
+
|
1837
|
+
def setUp(self) -> None:
|
1838
|
+
self.get_updated_product_prices = GetUpdatedProductPrices(
|
1839
|
+
integration=self.mock_integration
|
1840
|
+
)
|
1841
|
+
self.product_prices = [
|
1842
|
+
ProductPrice(
|
1843
|
+
pk=1,
|
1844
|
+
product=5,
|
1845
|
+
price='645670668.11',
|
1846
|
+
price_list=1,
|
1847
|
+
currency_type='try',
|
1848
|
+
tax_rate='32.61',
|
1849
|
+
retail_price=None,
|
1850
|
+
extra_field={},
|
1851
|
+
discount_percentage='63.57',
|
1852
|
+
modified_date='2024-01-02T07:53:06.392780Z',
|
1853
|
+
created_date='2024-01-02T07:53:06.392771Z',
|
1854
|
+
price_type='default'
|
1855
|
+
),
|
1856
|
+
ProductPrice(
|
1857
|
+
pk=2,
|
1858
|
+
product=6,
|
1859
|
+
price='493154528.49',
|
1860
|
+
price_list=2,
|
1861
|
+
currency_type='try',
|
1862
|
+
tax_rate='31.13',
|
1863
|
+
retail_price=None,
|
1864
|
+
extra_field={},
|
1865
|
+
discount_percentage='26.55',
|
1866
|
+
modified_date='2024-01-09T13:20:23.472505Z',
|
1867
|
+
created_date='2024-01-09T13:20:23.472485Z',
|
1868
|
+
price_type='default'
|
1869
|
+
)
|
1870
|
+
]
|
1871
|
+
self.product_prices_json = [
|
1872
|
+
{
|
1873
|
+
"pk": 1,
|
1874
|
+
"product": 5,
|
1875
|
+
"price": "645670668.11",
|
1876
|
+
"price_list": 1,
|
1877
|
+
"currency_type": "try",
|
1878
|
+
"tax_rate": "32.61",
|
1879
|
+
"retail_price": None,
|
1880
|
+
"extra_field": {},
|
1881
|
+
"discount_percentage": "63.57",
|
1882
|
+
"modified_date": "2024-01-02T07:53:06.392780Z",
|
1883
|
+
"created_date": "2024-01-02T07:53:06.392771Z",
|
1884
|
+
"price_type": "default"
|
1885
|
+
},
|
1886
|
+
{
|
1887
|
+
"pk": 2,
|
1888
|
+
"product": 6,
|
1889
|
+
"price": "493154528.49",
|
1890
|
+
"price_list": 2,
|
1891
|
+
"currency_type": "try",
|
1892
|
+
"tax_rate": "31.13",
|
1893
|
+
"retail_price": None,
|
1894
|
+
"extra_field": {},
|
1895
|
+
"discount_percentage": "26.55",
|
1896
|
+
"modified_date": "2024-01-09T13:20:23.472505Z",
|
1897
|
+
"created_date": "2024-01-09T13:20:23.472485Z",
|
1898
|
+
"price_type": "default"
|
1899
|
+
}
|
1900
|
+
]
|
1901
|
+
self.integration_actions = [
|
1902
|
+
MagicMock(
|
1903
|
+
pk=1,
|
1904
|
+
channel=2,
|
1905
|
+
content_type=ContentType.product_price.value,
|
1906
|
+
object_id=self.product_prices[0].pk,
|
1907
|
+
remote_id='1',
|
1908
|
+
version_date="2023-12-28T10:28:17.186730Z",
|
1909
|
+
state={},
|
1910
|
+
modified_date="2023-12-28T10:28:17.187032Z",
|
1911
|
+
local_batch_id=None,
|
1912
|
+
status=None,
|
1913
|
+
created_date="2023-12-28T10:28:17.187014Z"
|
1914
|
+
),
|
1915
|
+
MagicMock(
|
1916
|
+
pk=2,
|
1917
|
+
channel=2,
|
1918
|
+
content_type=ContentType.product_price.value,
|
1919
|
+
object_id=self.product_prices[1].pk,
|
1920
|
+
remote_id='2',
|
1921
|
+
version_date="2023-12-28T10:28:17.186730Z",
|
1922
|
+
state={},
|
1923
|
+
modified_date="2023-12-28T10:28:17.187032Z",
|
1924
|
+
local_batch_id=None,
|
1925
|
+
status=None,
|
1926
|
+
created_date="2023-12-28T10:28:17.187014Z"
|
1927
|
+
)
|
1928
|
+
]
|
1929
|
+
|
1930
|
+
@patch.object(
|
1931
|
+
GetUpdatedProductPrices,
|
1932
|
+
'get_product_prices'
|
1933
|
+
)
|
1934
|
+
@patch.object(
|
1935
|
+
GetUpdatedProductPrices,
|
1936
|
+
'get_integration_actions'
|
1937
|
+
)
|
1938
|
+
def test_get_data(
|
1939
|
+
self,
|
1940
|
+
mock_get_product_prices,
|
1941
|
+
mock_get_integration_actions
|
1942
|
+
):
|
1943
|
+
mock_get_product_prices.return_value = self.product_prices
|
1944
|
+
mock_get_integration_actions.return_value = self.integration_actions
|
1945
|
+
data = self.get_updated_product_prices.get_data()
|
1946
|
+
|
1947
|
+
self.assertEqual(len(data), 2)
|
1948
|
+
self.assertEqual(data[0].pk, self.product_prices[0].pk)
|
1949
|
+
self.assertEqual(data[1].pk, self.product_prices[1].pk)
|
1950
|
+
|
1951
|
+
@patch.object(BaseClient, 'get_instance')
|
1952
|
+
@patch.object(GetUpdatedProductPrices, 'create_batch_objects')
|
1953
|
+
@patch.object(GetUpdatedProductPrices, 'update_batch_request')
|
1954
|
+
def test_get_product_prices(
|
1955
|
+
self,
|
1956
|
+
mock_get_instance,
|
1957
|
+
mock_create_batch_objects,
|
1958
|
+
mock_update_batch_request
|
1959
|
+
):
|
1960
|
+
example_response = MagicMock()
|
1961
|
+
example_response.list.return_value = self.product_prices_json
|
1962
|
+
|
1963
|
+
with patch.object(
|
1964
|
+
ChannelProductPriceEndpoint,
|
1965
|
+
'__new__',
|
1966
|
+
return_value=example_response
|
1967
|
+
):
|
1968
|
+
data = self.get_updated_product_prices.get_product_prices()
|
1969
|
+
|
1970
|
+
self.assertEqual(len(data), 2)
|
1971
|
+
self.assertEqual(data[0].get('pk'), self.product_prices[0].pk)
|
1972
|
+
self.assertEqual(data[1].get('pk'), self.product_prices[1].pk)
|
1973
|
+
|
1974
|
+
@patch.object(BaseClient, 'get_instance')
|
1975
|
+
def test_get_integration_actions(self, mock_get_instance):
|
1976
|
+
example_response = MagicMock()
|
1977
|
+
example_response.list.return_value = self.integration_actions
|
1978
|
+
example_response.iterator = iter(self.integration_actions)
|
1979
|
+
|
1980
|
+
with patch.object(
|
1981
|
+
ChannelIntegrationActionEndpoint,
|
1982
|
+
'__new__',
|
1983
|
+
return_value=example_response
|
1984
|
+
):
|
1985
|
+
data = self.get_updated_product_prices.get_integration_actions(
|
1986
|
+
self.product_prices
|
1987
|
+
)
|
1988
|
+
|
1989
|
+
self.assertEqual(len(data), 2)
|
1990
|
+
self.assertEqual(data[0].pk, self.integration_actions[0].object_id)
|
1991
|
+
self.assertEqual(data[1].pk, self.integration_actions[1].object_id)
|
1992
|
+
self.assertEqual(
|
1993
|
+
data[0].remote_id,
|
1994
|
+
self.integration_actions[0].remote_id
|
1995
|
+
)
|
1996
|
+
self.assertEqual(
|
1997
|
+
data[1].remote_id,
|
1998
|
+
self.integration_actions[1].remote_id
|
1999
|
+
)
|
2000
|
+
|
2001
|
+
|
2002
|
+
class TestGetInsertedProductPrices(BaseTestCaseMixin):
|
2003
|
+
"""
|
2004
|
+
Test case for GetInsertedProductPrices
|
2005
|
+
run: python -m unittest channel_app.omnitron.commands.tests.test_products.TestGetInsertedProductPrices
|
2006
|
+
"""
|
2007
|
+
def setUp(self) -> None:
|
2008
|
+
self.get_inserted_product_prices = GetInsertedProductPrices(
|
2009
|
+
integration=self.mock_integration
|
2010
|
+
)
|
2011
|
+
self.product_prices = [
|
2012
|
+
ProductPrice(
|
2013
|
+
pk=1,
|
2014
|
+
product=5,
|
2015
|
+
price='645670668.11',
|
2016
|
+
price_list=1,
|
2017
|
+
currency_type='try',
|
2018
|
+
tax_rate='32.61',
|
2019
|
+
remote_id='1',
|
2020
|
+
retail_price=None,
|
2021
|
+
extra_field={},
|
2022
|
+
discount_percentage='63.57',
|
2023
|
+
modified_date='2024-01-02T07:53:06.392780Z',
|
2024
|
+
created_date='2024-01-02T07:53:06.392771Z',
|
2025
|
+
price_type='default'
|
2026
|
+
),
|
2027
|
+
ProductPrice(
|
2028
|
+
pk=2,
|
2029
|
+
product=6,
|
2030
|
+
price='493154528.49',
|
2031
|
+
price_list=2,
|
2032
|
+
currency_type='try',
|
2033
|
+
tax_rate='31.13',
|
2034
|
+
remote_id='2',
|
2035
|
+
retail_price=None,
|
2036
|
+
extra_field={},
|
2037
|
+
discount_percentage='26.55',
|
2038
|
+
modified_date='2024-01-09T13:20:23.472505Z',
|
2039
|
+
created_date='2024-01-09T13:20:23.472485Z',
|
2040
|
+
price_type='default'
|
2041
|
+
)
|
2042
|
+
]
|
2043
|
+
self.product_prices_json = [
|
2044
|
+
{
|
2045
|
+
"pk": 1,
|
2046
|
+
"product": 5,
|
2047
|
+
"price": "645670668.11",
|
2048
|
+
"price_list": 1,
|
2049
|
+
"currency_type": "try",
|
2050
|
+
"tax_rate": "32.61",
|
2051
|
+
"remote_id": None,
|
2052
|
+
"retail_price": None,
|
2053
|
+
"extra_field": {},
|
2054
|
+
"discount_percentage": "63.57",
|
2055
|
+
"modified_date": "2024-01-02T07:53:06.392780Z",
|
2056
|
+
"created_date": "2024-01-02T07:53:06.392771Z",
|
2057
|
+
"price_type": "default"
|
2058
|
+
},
|
2059
|
+
{
|
2060
|
+
"pk": 2,
|
2061
|
+
"product": 6,
|
2062
|
+
"price": "493154528.49",
|
2063
|
+
"price_list": 2,
|
2064
|
+
"currency_type": "try",
|
2065
|
+
"tax_rate": "31.13",
|
2066
|
+
"remote_id": None,
|
2067
|
+
"retail_price": None,
|
2068
|
+
"extra_field": {},
|
2069
|
+
"discount_percentage": "26.55",
|
2070
|
+
"modified_date": "2024-01-09T13:20:23.472505Z",
|
2071
|
+
"created_date": "2024-01-09T13:20:23.472485Z",
|
2072
|
+
"price_type": "default"
|
2073
|
+
}
|
2074
|
+
]
|
2075
|
+
self.integration_actions = [
|
2076
|
+
MagicMock(
|
2077
|
+
pk=1,
|
2078
|
+
channel=2,
|
2079
|
+
content_type=ContentType.product_price.value,
|
2080
|
+
object_id=self.product_prices[0].pk,
|
2081
|
+
remote_id='1',
|
2082
|
+
version_date="2023-12-28T10:28:17.186730Z",
|
2083
|
+
state={},
|
2084
|
+
modified_date="2023-12-28T10:28:17.187032Z",
|
2085
|
+
local_batch_id=None,
|
2086
|
+
status=None,
|
2087
|
+
created_date="2023-12-28T10:28:17.187014Z"
|
2088
|
+
),
|
2089
|
+
MagicMock(
|
2090
|
+
pk=2,
|
2091
|
+
channel=2,
|
2092
|
+
content_type=ContentType.product_price.value,
|
2093
|
+
object_id=self.product_prices[1].pk,
|
2094
|
+
remote_id='2',
|
2095
|
+
version_date="2023-12-28T10:28:17.186730Z",
|
2096
|
+
state={},
|
2097
|
+
modified_date="2023-12-28T10:28:17.187032Z",
|
2098
|
+
local_batch_id=None,
|
2099
|
+
status=None,
|
2100
|
+
created_date="2023-12-28T10:28:17.187014Z"
|
2101
|
+
)
|
2102
|
+
]
|
2103
|
+
|
2104
|
+
@patch.object(BaseClient, 'get_instance')
|
2105
|
+
def test_get_integration_actions(self, mock_get_instance):
|
2106
|
+
example_response = MagicMock()
|
2107
|
+
example_response.list.return_value = self.integration_actions
|
2108
|
+
example_response.iterator = iter(self.integration_actions)
|
2109
|
+
|
2110
|
+
with patch.object(
|
2111
|
+
ChannelIntegrationActionEndpoint,
|
2112
|
+
'__new__',
|
2113
|
+
return_value=example_response
|
2114
|
+
):
|
2115
|
+
data = self.get_inserted_product_prices.get_integration_actions(
|
2116
|
+
self.product_prices
|
2117
|
+
)
|
2118
|
+
|
2119
|
+
self.assertEqual(len(data), 2)
|
2120
|
+
self.assertEqual(data[0].pk, self.integration_actions[0].object_id)
|
2121
|
+
self.assertEqual(data[1].pk, self.integration_actions[1].object_id)
|
2122
|
+
self.assertEqual(
|
2123
|
+
data[0].remote_id,
|
2124
|
+
self.integration_actions[0].remote_id
|
2125
|
+
)
|
2126
|
+
self.assertEqual(
|
2127
|
+
data[1].remote_id,
|
2128
|
+
self.integration_actions[1].remote_id
|
2129
|
+
)
|
2130
|
+
|
2131
|
+
|
2132
|
+
class TestGetInsertedProductPricesFromExtraPriceList(BaseTestCaseMixin):
|
2133
|
+
"""
|
2134
|
+
Test case for GetInsertedProductPricesFromExtraPriceList
|
2135
|
+
run: python -m unittest channel_app.omnitron.commands.tests.test_products.TestGetInsertedProductPricesFromExtraPriceList
|
2136
|
+
"""
|
2137
|
+
def setUp(self) -> None:
|
2138
|
+
self.get_inserted_product_prices_from_extra_price_list = GetInsertedProductPricesFromExtraPriceList(
|
2139
|
+
integration=self.mock_integration
|
2140
|
+
)
|
2141
|
+
self.product_prices = [
|
2142
|
+
ProductPrice(
|
2143
|
+
pk=1,
|
2144
|
+
product=5,
|
2145
|
+
price='645670668.11',
|
2146
|
+
price_list=1,
|
2147
|
+
currency_type='try',
|
2148
|
+
tax_rate='32.61',
|
2149
|
+
remote_id='1',
|
2150
|
+
retail_price=None,
|
2151
|
+
extra_field={},
|
2152
|
+
discount_percentage='63.57',
|
2153
|
+
modified_date='2024-01-02T07:53:06.392780Z',
|
2154
|
+
created_date='2024-01-02T07:53:06.392771Z',
|
2155
|
+
price_type='default'
|
2156
|
+
),
|
2157
|
+
ProductPrice(
|
2158
|
+
pk=2,
|
2159
|
+
product=6,
|
2160
|
+
price='493154528.49',
|
2161
|
+
price_list=2,
|
2162
|
+
currency_type='try',
|
2163
|
+
tax_rate='31.13',
|
2164
|
+
remote_id='2',
|
2165
|
+
retail_price=None,
|
2166
|
+
extra_field={},
|
2167
|
+
discount_percentage='26.55',
|
2168
|
+
modified_date='2024-01-09T13:20:23.472505Z',
|
2169
|
+
created_date='2024-01-09T13:20:23.472485Z',
|
2170
|
+
price_type='default'
|
2171
|
+
)
|
2172
|
+
]
|
2173
|
+
self.product_prices_json = [
|
2174
|
+
{
|
2175
|
+
"pk": 1,
|
2176
|
+
"product": 5,
|
2177
|
+
"price": "645670668.11",
|
2178
|
+
"price_list": 1,
|
2179
|
+
"currency_type": "try",
|
2180
|
+
"tax_rate": "32.61",
|
2181
|
+
"remote_id": None,
|
2182
|
+
"retail_price": None,
|
2183
|
+
"extra_field": {},
|
2184
|
+
"discount_percentage": "63.57",
|
2185
|
+
"modified_date": "2024-01-02T07:53:06.392780Z",
|
2186
|
+
"created_date": "2024-01-02T07:53:06.392771Z",
|
2187
|
+
"price_type": "default"
|
2188
|
+
},
|
2189
|
+
{
|
2190
|
+
"pk": 2,
|
2191
|
+
"product": 6,
|
2192
|
+
"price": "493154528.49",
|
2193
|
+
"price_list": 2,
|
2194
|
+
"currency_type": "try",
|
2195
|
+
"tax_rate": "31.13",
|
2196
|
+
"remote_id": None,
|
2197
|
+
"retail_price": None,
|
2198
|
+
"extra_field": {},
|
2199
|
+
"discount_percentage": "26.55",
|
2200
|
+
"modified_date": "2024-01-09T13:20:23.472505Z",
|
2201
|
+
"created_date": "2024-01-09T13:20:23.472485Z",
|
2202
|
+
"price_type": "default"
|
2203
|
+
}
|
2204
|
+
]
|
2205
|
+
self.integration_actions = [
|
2206
|
+
MagicMock(
|
2207
|
+
pk=1,
|
2208
|
+
channel=2,
|
2209
|
+
content_type=ContentType.product_price.value,
|
2210
|
+
object_id=self.product_prices[0].pk,
|
2211
|
+
remote_id='1',
|
2212
|
+
version_date="2023-12-28T10:28:17.186730Z",
|
2213
|
+
state={},
|
2214
|
+
modified_date="2023-12-28T10:28:17.187032Z",
|
2215
|
+
local_batch_id=None,
|
2216
|
+
status=None,
|
2217
|
+
created_date="2023-12-28T10:28:17.187014Z"
|
2218
|
+
),
|
2219
|
+
MagicMock(
|
2220
|
+
pk=2,
|
2221
|
+
channel=2,
|
2222
|
+
content_type=ContentType.product_price.value,
|
2223
|
+
object_id=self.product_prices[1].pk,
|
2224
|
+
remote_id='2',
|
2225
|
+
version_date="2023-12-28T10:28:17.186730Z",
|
2226
|
+
state={},
|
2227
|
+
modified_date="2023-12-28T10:28:17.187032Z",
|
2228
|
+
local_batch_id=None,
|
2229
|
+
status=None,
|
2230
|
+
created_date="2023-12-28T10:28:17.187014Z"
|
2231
|
+
)
|
2232
|
+
]
|
2233
|
+
|
2234
|
+
def test_get_integration_actions(self):
|
2235
|
+
example_response = MagicMock()
|
2236
|
+
example_response.list.return_value = self.integration_actions
|
2237
|
+
example_response.iterator = iter(self.integration_actions)
|
2238
|
+
|
2239
|
+
with patch.object(
|
2240
|
+
ChannelIntegrationActionEndpoint,
|
2241
|
+
'__new__',
|
2242
|
+
return_value=example_response
|
2243
|
+
):
|
2244
|
+
data = self.get_inserted_product_prices_from_extra_price_list.get_integration_actions(
|
2245
|
+
self.product_prices
|
2246
|
+
)
|
2247
|
+
|
2248
|
+
self.assertEqual(len(data), 2)
|
2249
|
+
self.assertEqual(data[0].pk, self.integration_actions[0].object_id)
|
2250
|
+
self.assertEqual(data[1].pk, self.integration_actions[1].object_id)
|
2251
|
+
self.assertEqual(
|
2252
|
+
data[0].remote_id,
|
2253
|
+
self.integration_actions[0].remote_id
|
2254
|
+
)
|
2255
|
+
self.assertEqual(
|
2256
|
+
data[1].remote_id,
|
2257
|
+
self.integration_actions[1].remote_id
|
2258
|
+
)
|
2259
|
+
|
2260
|
+
|
2261
|
+
class TestGetUpdatedProductPricesFromExtraPriceList(BaseTestCaseMixin):
|
2262
|
+
"""
|
2263
|
+
Test case for GetUpdatedProductPricesFromExtraPriceList
|
2264
|
+
run: python -m unittest channel_app.omnitron.commands.tests.test_products.TestGetUpdatedProductPricesFromExtraPriceList
|
2265
|
+
"""
|
2266
|
+
def setUp(self) -> None:
|
2267
|
+
self.get_updated_product_prices_from_extra_price_list = GetUpdatedProductPricesFromExtraPriceList(
|
2268
|
+
integration=self.mock_integration
|
2269
|
+
)
|
2270
|
+
self.get_updated_product_prices_from_extra_price_list.objects = [1, 2]
|
2271
|
+
self.get_updated_product_prices_from_extra_price_list.price_list_id = 1
|
2272
|
+
self.product_prices = [
|
2273
|
+
ProductPrice(
|
2274
|
+
pk=1,
|
2275
|
+
product=5,
|
2276
|
+
price='645670668.11',
|
2277
|
+
price_list=1,
|
2278
|
+
currency_type='try',
|
2279
|
+
tax_rate='32.61',
|
2280
|
+
remote_id='1',
|
2281
|
+
retail_price=None,
|
2282
|
+
extra_field={},
|
2283
|
+
discount_percentage='63.57',
|
2284
|
+
modified_date='2024-01-02T07:53:06.392780Z',
|
2285
|
+
created_date='2024-01-02T07:53:06.392771Z',
|
2286
|
+
price_type='default'
|
2287
|
+
),
|
2288
|
+
ProductPrice(
|
2289
|
+
pk=2,
|
2290
|
+
product=6,
|
2291
|
+
price='493154528.49',
|
2292
|
+
price_list=1,
|
2293
|
+
currency_type='try',
|
2294
|
+
tax_rate='31.13',
|
2295
|
+
remote_id='2',
|
2296
|
+
retail_price=None,
|
2297
|
+
extra_field={},
|
2298
|
+
discount_percentage='26.55',
|
2299
|
+
modified_date='2024-01-09T13:20:23.472505Z',
|
2300
|
+
created_date='2024-01-09T13:20:23.472485Z',
|
2301
|
+
price_type='default'
|
2302
|
+
)
|
2303
|
+
]
|
2304
|
+
self.product_prices_json = [
|
2305
|
+
{
|
2306
|
+
"pk": 1,
|
2307
|
+
"product": 5,
|
2308
|
+
"price": "645670668.11",
|
2309
|
+
"price_list": 1,
|
2310
|
+
"currency_type": "try",
|
2311
|
+
"tax_rate": "32.61",
|
2312
|
+
"remote_id": None,
|
2313
|
+
"retail_price": None,
|
2314
|
+
"extra_field": {},
|
2315
|
+
"discount_percentage": "63.57",
|
2316
|
+
"modified_date": "2024-01-02T07:53:06.392780Z",
|
2317
|
+
"created_date": "2024-01-02T07:53:06.392771Z",
|
2318
|
+
"price_type": "default"
|
2319
|
+
},
|
2320
|
+
{
|
2321
|
+
"pk": 2,
|
2322
|
+
"product": 6,
|
2323
|
+
"price": "493154528.49",
|
2324
|
+
"price_list": 1,
|
2325
|
+
"currency_type": "try",
|
2326
|
+
"tax_rate": "31.13",
|
2327
|
+
"remote_id": None,
|
2328
|
+
"retail_price": None,
|
2329
|
+
"extra_field": {},
|
2330
|
+
"discount_percentage": "26.55",
|
2331
|
+
"modified_date": "2024-01-09T13:20:23.472505Z",
|
2332
|
+
"created_date": "2024-01-09T13:20:23.472485Z",
|
2333
|
+
"price_type": "default"
|
2334
|
+
}
|
2335
|
+
]
|
2336
|
+
self.integration_actions = [
|
2337
|
+
MagicMock(
|
2338
|
+
pk=1,
|
2339
|
+
channel=2,
|
2340
|
+
content_type=ContentType.product_price.value,
|
2341
|
+
object_id=self.product_prices[0].pk,
|
2342
|
+
remote_id='1',
|
2343
|
+
version_date="2023-12-28T10:28:17.186730Z",
|
2344
|
+
state={},
|
2345
|
+
modified_date="2023-12-28T10:28:17.187032Z",
|
2346
|
+
local_batch_id=None,
|
2347
|
+
status=None,
|
2348
|
+
created_date="2023-12-28T10:28:17.187014Z"
|
2349
|
+
),
|
2350
|
+
MagicMock(
|
2351
|
+
pk=2,
|
2352
|
+
channel=2,
|
2353
|
+
content_type=ContentType.product_price.value,
|
2354
|
+
object_id=self.product_prices[1].pk,
|
2355
|
+
remote_id='2',
|
2356
|
+
version_date="2023-12-28T10:28:17.186730Z",
|
2357
|
+
state={},
|
2358
|
+
modified_date="2023-12-28T10:28:17.187032Z",
|
2359
|
+
local_batch_id=None,
|
2360
|
+
status=None,
|
2361
|
+
created_date="2023-12-28T10:28:17.187014Z"
|
2362
|
+
)
|
2363
|
+
]
|
2364
|
+
|
2365
|
+
@patch.object(
|
2366
|
+
GetUpdatedProductPricesFromExtraPriceList,
|
2367
|
+
'get_product_prices'
|
2368
|
+
)
|
2369
|
+
@patch.object(
|
2370
|
+
GetUpdatedProductPricesFromExtraPriceList,
|
2371
|
+
'get_integration_actions'
|
2372
|
+
)
|
2373
|
+
def test_get_data(
|
2374
|
+
self,
|
2375
|
+
mock_get_product_prices,
|
2376
|
+
mock_get_integration_actions
|
2377
|
+
):
|
2378
|
+
mock_get_product_prices.return_value = self.product_prices
|
2379
|
+
mock_get_integration_actions.return_value = self.integration_actions
|
2380
|
+
data = self.get_updated_product_prices_from_extra_price_list.get_data()
|
2381
|
+
self.assertEqual(len(data), 2)
|
2382
|
+
self.assertEqual(data[0].pk, self.product_prices[0].pk)
|
2383
|
+
self.assertEqual(data[1].pk, self.product_prices[1].pk)
|
2384
|
+
|
2385
|
+
@patch.object(
|
2386
|
+
BaseClient,
|
2387
|
+
'get_instance'
|
2388
|
+
)
|
2389
|
+
@patch.object(
|
2390
|
+
GetUpdatedProductPricesFromExtraPriceList,
|
2391
|
+
'create_batch_objects'
|
2392
|
+
)
|
2393
|
+
@patch.object(
|
2394
|
+
GetUpdatedProductPricesFromExtraPriceList,
|
2395
|
+
'update_batch_request'
|
2396
|
+
)
|
2397
|
+
def test_get_product_prices(
|
2398
|
+
self,
|
2399
|
+
mock_get_instance,
|
2400
|
+
mock_create_batch_objects,
|
2401
|
+
mock_update_batch_request
|
2402
|
+
):
|
2403
|
+
example_response = MagicMock()
|
2404
|
+
example_response.list.return_value = self.product_prices_json
|
2405
|
+
|
2406
|
+
with patch.object(
|
2407
|
+
ChannelExtraProductPriceEndpoint,
|
2408
|
+
'__new__',
|
2409
|
+
return_value=example_response
|
2410
|
+
):
|
2411
|
+
data = self.get_updated_product_prices_from_extra_price_list.get_product_prices()
|
2412
|
+
|
2413
|
+
self.assertEqual(len(data), 2)
|
2414
|
+
self.assertEqual(data[0].get('pk'), self.product_prices[0].pk)
|
2415
|
+
self.assertEqual(data[1].get('pk'), self.product_prices[1].pk)
|
2416
|
+
|
2417
|
+
def test_get_integration_actions_with_empty_prices(self):
|
2418
|
+
self.product_prices = []
|
2419
|
+
data = self.get_updated_product_prices_from_extra_price_list.get_integration_actions(
|
2420
|
+
self.product_prices
|
2421
|
+
)
|
2422
|
+
self.assertEqual(data, [])
|
2423
|
+
|
2424
|
+
@patch.object(BaseClient, 'get_instance')
|
2425
|
+
def test_get_integration_actions(self, mock_get_instance):
|
2426
|
+
example_response = MagicMock()
|
2427
|
+
example_response.list.return_value = self.integration_actions
|
2428
|
+
example_response.iterator = iter(self.integration_actions)
|
2429
|
+
|
2430
|
+
with patch.object(
|
2431
|
+
ChannelIntegrationActionEndpoint,
|
2432
|
+
'__new__',
|
2433
|
+
return_value=example_response
|
2434
|
+
):
|
2435
|
+
data = self.get_updated_product_prices_from_extra_price_list.get_integration_actions(
|
2436
|
+
self.product_prices
|
2437
|
+
)
|
2438
|
+
|
2439
|
+
self.assertEqual(len(data), 2)
|
2440
|
+
self.assertEqual(data[0].pk, self.integration_actions[0].object_id)
|
2441
|
+
self.assertEqual(data[1].pk, self.integration_actions[1].object_id)
|
2442
|
+
self.assertEqual(
|
2443
|
+
data[0].remote_id,
|
2444
|
+
self.integration_actions[0].remote_id
|
2445
|
+
)
|
2446
|
+
self.assertEqual(
|
2447
|
+
data[1].remote_id,
|
2448
|
+
self.integration_actions[1].remote_id
|
2449
|
+
)
|
@@ -1,14 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: channel-app
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.140
|
4
4
|
Summary: Channel app for Sales Channels
|
5
5
|
Home-page: https://github.com/akinon/channel_app
|
6
6
|
Author: akinonteam
|
7
7
|
License: UNKNOWN
|
8
|
+
Description: UNKNOWN
|
8
9
|
Platform: UNKNOWN
|
9
10
|
Classifier: Development Status :: 5 - Production/Stable
|
10
11
|
Requires-Python: >=3.5
|
11
12
|
Description-Content-Type: text/markdown
|
12
|
-
|
13
|
-
UNKNOWN
|
14
|
-
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{channel_app-0.0.139 → channel_app-0.0.140}/channel_app/channel/commands/product_categories.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/integration_actions.py
RENAMED
File without changes
|
{channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/orders/__init__.py
RENAMED
File without changes
|
{channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/orders/addresses.py
RENAMED
File without changes
|
{channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/orders/cargo_companies.py
RENAMED
File without changes
|
{channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/orders/customers.py
RENAMED
File without changes
|
File without changes
|
{channel_app-0.0.139 → channel_app-0.0.140}/channel_app/omnitron/commands/product_categories.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{channel_app-0.0.139 → channel_app-0.0.140}/docs/source/images/batch_request_state_machine.png
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|