channel-app 0.0.131__tar.gz → 0.0.135__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.
Files changed (141) hide show
  1. channel_app-0.0.135/.gitignore +86 -0
  2. channel_app-0.0.135/.vscode/settings.json +6 -0
  3. channel_app-0.0.135/Makefile +51 -0
  4. {channel_app-0.0.131 → channel_app-0.0.135}/PKG-INFO +1 -1
  5. channel_app-0.0.135/Procfile-dist +2 -0
  6. channel_app-0.0.135/akinon.json-dist +33 -0
  7. channel_app-0.0.135/bitbucket-pipelines.yml +14 -0
  8. channel_app-0.0.135/build.sh-dist +1 -0
  9. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/app/product/service.py +16 -0
  10. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/core/commands.py +3 -1
  11. channel_app-0.0.131/channel_app/core/tests.py → channel_app-0.0.135/channel_app/core/tests/test_clients.py +4 -5
  12. channel_app-0.0.135/channel_app/core/tests.py +16 -0
  13. channel_app-0.0.135/channel_app/omnitron/commands/tests/test_products.py +494 -0
  14. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app.egg-info/PKG-INFO +1 -1
  15. channel_app-0.0.135/channel_app.egg-info/SOURCES.txt +87 -0
  16. channel_app-0.0.135/docs/Makefile +20 -0
  17. channel_app-0.0.135/docs/make.bat +35 -0
  18. channel_app-0.0.135/docs/requirements.txt +2 -0
  19. channel_app-0.0.135/docs/source/architecture.rst +108 -0
  20. channel_app-0.0.135/docs/source/command_reference.rst +317 -0
  21. channel_app-0.0.135/docs/source/conf.py +67 -0
  22. channel_app-0.0.135/docs/source/flows.rst +149 -0
  23. channel_app-0.0.135/docs/source/images/async.png +0 -0
  24. channel_app-0.0.135/docs/source/images/batch_request_state_machine.png +0 -0
  25. channel_app-0.0.135/docs/source/images/sync.png +0 -0
  26. channel_app-0.0.135/docs/source/index.rst +42 -0
  27. channel_app-0.0.135/docs/source/installation_and_usage.rst +294 -0
  28. channel_app-0.0.135/docs/source/terminology.rst +39 -0
  29. channel_app-0.0.135/requirements-dev.txt +2 -0
  30. channel_app-0.0.135/requirements.txt +6 -0
  31. {channel_app-0.0.131 → channel_app-0.0.135}/setup.py +1 -1
  32. channel_app-0.0.135/tox.ini +13 -0
  33. channel_app-0.0.131/channel_app/channel_app/app/order/service.py +0 -230
  34. channel_app-0.0.131/channel_app/channel_app/app/product/service.py +0 -237
  35. channel_app-0.0.131/channel_app/channel_app/app/product_price/service.py +0 -254
  36. channel_app-0.0.131/channel_app/channel_app/app/product_stock/__init__.py +0 -0
  37. channel_app-0.0.131/channel_app/channel_app/app/product_stock/service.py +0 -258
  38. channel_app-0.0.131/channel_app/channel_app/app/setup/__init__.py +0 -0
  39. channel_app-0.0.131/channel_app/channel_app/app/setup/service.py +0 -61
  40. channel_app-0.0.131/channel_app/channel_app/channel/__init__.py +0 -0
  41. channel_app-0.0.131/channel_app/channel_app/channel/commands/__init__.py +0 -0
  42. channel_app-0.0.131/channel_app/channel_app/channel/commands/orders/__init__.py +0 -0
  43. channel_app-0.0.131/channel_app/channel_app/channel/commands/orders/orders.py +0 -329
  44. channel_app-0.0.131/channel_app/channel_app/channel/commands/product_categories.py +0 -1
  45. channel_app-0.0.131/channel_app/channel_app/channel/commands/product_images.py +0 -1
  46. channel_app-0.0.131/channel_app/channel_app/channel/commands/product_prices.py +0 -148
  47. channel_app-0.0.131/channel_app/channel_app/channel/commands/product_stocks.py +0 -220
  48. channel_app-0.0.131/channel_app/channel_app/channel/commands/products.py +0 -161
  49. channel_app-0.0.131/channel_app/channel_app/channel/commands/setup.py +0 -948
  50. channel_app-0.0.131/channel_app/channel_app/channel/integration.py +0 -84
  51. channel_app-0.0.131/channel_app/channel_app/core/__init__.py +0 -0
  52. channel_app-0.0.131/channel_app/channel_app/core/clients.py +0 -12
  53. channel_app-0.0.131/channel_app/channel_app/core/commands.py +0 -364
  54. channel_app-0.0.131/channel_app/channel_app/core/data.py +0 -227
  55. channel_app-0.0.131/channel_app/channel_app/core/utilities.py +0 -99
  56. channel_app-0.0.131/channel_app/channel_app/omnitron/__init__.py +0 -0
  57. channel_app-0.0.131/channel_app/channel_app/omnitron/batch_request.py +0 -82
  58. channel_app-0.0.131/channel_app/channel_app/omnitron/commands/__init__.py +0 -0
  59. channel_app-0.0.131/channel_app/channel_app/omnitron/commands/batch_requests.py +0 -281
  60. channel_app-0.0.131/channel_app/channel_app/omnitron/commands/integration_actions.py +0 -200
  61. channel_app-0.0.131/channel_app/channel_app/omnitron/commands/orders/__init__.py +0 -0
  62. channel_app-0.0.131/channel_app/channel_app/omnitron/commands/orders/addresses.py +0 -242
  63. channel_app-0.0.131/channel_app/channel_app/omnitron/commands/orders/customers.py +0 -72
  64. channel_app-0.0.131/channel_app/channel_app/omnitron/commands/orders/orders.py +0 -450
  65. channel_app-0.0.131/channel_app/channel_app/omnitron/commands/product_images.py +0 -1
  66. channel_app-0.0.131/channel_app/channel_app/omnitron/commands/product_prices.py +0 -192
  67. channel_app-0.0.131/channel_app/channel_app/omnitron/commands/product_stocks.py +0 -229
  68. channel_app-0.0.131/channel_app/channel_app/omnitron/commands/products.py +0 -735
  69. channel_app-0.0.131/channel_app/channel_app/omnitron/commands/setup.py +0 -839
  70. channel_app-0.0.131/channel_app/channel_app/omnitron/integration.py +0 -159
  71. channel_app-0.0.131/channel_app/core/__init__.py +0 -0
  72. channel_app-0.0.131/channel_app/core/integration.py +0 -74
  73. channel_app-0.0.131/channel_app/core/products.py +0 -64
  74. channel_app-0.0.131/channel_app/core/settings.py +0 -28
  75. channel_app-0.0.131/channel_app/omnitron/__init__.py +0 -0
  76. channel_app-0.0.131/channel_app/omnitron/commands/__init__.py +0 -0
  77. channel_app-0.0.131/channel_app/omnitron/commands/error_reports.py +0 -86
  78. channel_app-0.0.131/channel_app/omnitron/commands/orders/__init__.py +0 -0
  79. channel_app-0.0.131/channel_app/omnitron/commands/orders/cargo_companies.py +0 -40
  80. channel_app-0.0.131/channel_app/omnitron/commands/product_categories.py +0 -1
  81. channel_app-0.0.131/channel_app/omnitron/constants.py +0 -98
  82. channel_app-0.0.131/channel_app/omnitron/exceptions.py +0 -42
  83. channel_app-0.0.131/channel_app/setup.py +0 -21
  84. channel_app-0.0.131/channel_app.egg-info/SOURCES.txt +0 -113
  85. {channel_app-0.0.131 → channel_app-0.0.135}/README.md +0 -0
  86. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/__init__.py +0 -0
  87. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/app/__init__.py +0 -0
  88. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/app/order/__init__.py +0 -0
  89. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/app/order/service.py +0 -0
  90. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/app/product/__init__.py +0 -0
  91. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/app/product_image/__init__.py +0 -0
  92. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/app/product_image/service.py +0 -0
  93. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/app/product_price/__init__.py +0 -0
  94. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/app/product_price/service.py +0 -0
  95. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/app/product_stock/__init__.py +0 -0
  96. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/app/product_stock/service.py +0 -0
  97. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/app/setup/__init__.py +0 -0
  98. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/app/setup/service.py +0 -0
  99. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/channel/__init__.py +0 -0
  100. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/channel/commands/__init__.py +0 -0
  101. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/channel/commands/orders/__init__.py +0 -0
  102. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/channel/commands/orders/orders.py +0 -0
  103. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/channel/commands/product_categories.py +0 -0
  104. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/channel/commands/product_images.py +0 -0
  105. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/channel/commands/product_prices.py +0 -0
  106. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/channel/commands/product_stocks.py +0 -0
  107. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/channel/commands/products.py +0 -0
  108. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/channel/commands/setup.py +0 -0
  109. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/channel/integration.py +0 -0
  110. {channel_app-0.0.131/channel_app/channel_app → channel_app-0.0.135/channel_app/core}/__init__.py +0 -0
  111. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/core/clients.py +0 -0
  112. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/core/data.py +0 -0
  113. {channel_app-0.0.131/channel_app → channel_app-0.0.135}/channel_app/core/integration.py +0 -0
  114. {channel_app-0.0.131/channel_app → channel_app-0.0.135}/channel_app/core/products.py +0 -0
  115. {channel_app-0.0.131/channel_app → channel_app-0.0.135}/channel_app/core/settings.py +0 -0
  116. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/core/utilities.py +0 -0
  117. {channel_app-0.0.131/channel_app/channel_app/app → channel_app-0.0.135/channel_app/omnitron}/__init__.py +0 -0
  118. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/omnitron/batch_request.py +0 -0
  119. {channel_app-0.0.131/channel_app/channel_app/app/order → channel_app-0.0.135/channel_app/omnitron/commands}/__init__.py +0 -0
  120. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/omnitron/commands/batch_requests.py +0 -0
  121. {channel_app-0.0.131/channel_app → channel_app-0.0.135}/channel_app/omnitron/commands/error_reports.py +0 -0
  122. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/omnitron/commands/integration_actions.py +0 -0
  123. {channel_app-0.0.131/channel_app/channel_app/app/product → channel_app-0.0.135/channel_app/omnitron/commands/orders}/__init__.py +0 -0
  124. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/omnitron/commands/orders/addresses.py +0 -0
  125. {channel_app-0.0.131/channel_app → channel_app-0.0.135}/channel_app/omnitron/commands/orders/cargo_companies.py +0 -0
  126. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/omnitron/commands/orders/customers.py +0 -0
  127. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/omnitron/commands/orders/orders.py +0 -0
  128. {channel_app-0.0.131/channel_app → channel_app-0.0.135}/channel_app/omnitron/commands/product_categories.py +0 -0
  129. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/omnitron/commands/product_images.py +0 -0
  130. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/omnitron/commands/product_prices.py +0 -0
  131. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/omnitron/commands/product_stocks.py +0 -0
  132. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/omnitron/commands/products.py +0 -0
  133. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/omnitron/commands/setup.py +0 -0
  134. {channel_app-0.0.131/channel_app/channel_app/app/product_price → channel_app-0.0.135/channel_app/omnitron/commands/tests}/__init__.py +0 -0
  135. {channel_app-0.0.131/channel_app → channel_app-0.0.135}/channel_app/omnitron/constants.py +0 -0
  136. {channel_app-0.0.131/channel_app → channel_app-0.0.135}/channel_app/omnitron/exceptions.py +0 -0
  137. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app/omnitron/integration.py +0 -0
  138. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app.egg-info/dependency_links.txt +0 -0
  139. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app.egg-info/requires.txt +0 -0
  140. {channel_app-0.0.131 → channel_app-0.0.135}/channel_app.egg-info/top_level.txt +0 -0
  141. {channel_app-0.0.131 → channel_app-0.0.135}/setup.cfg +0 -0
@@ -0,0 +1,86 @@
1
+ # These are some examples of commonly ignored file patterns.
2
+ # You should customize this list as applicable to your project.
3
+ # Learn more about .gitignore:
4
+ # https://www.atlassian.com/git/tutorials/saving-changes/gitignore
5
+
6
+ # Node artifact files
7
+ node_modules/
8
+ dist/
9
+ .Python
10
+ build/
11
+ develop-eggs/
12
+ downloads/
13
+ eggs/
14
+ .eggs/
15
+ lib/
16
+ lib64/
17
+ parts/
18
+ sdist/
19
+ var/
20
+ wheels/
21
+ share/python-wheels/
22
+ *.egg-info/
23
+ .installed.cfg
24
+ *.egg
25
+ MANIFEST
26
+ # Compiled Java class files
27
+ *.class
28
+
29
+ # Compiled Python bytecode
30
+ *.py[cod]
31
+
32
+ *.egg-info
33
+ # Log files
34
+ *.log
35
+
36
+ # Package files
37
+ *.jar
38
+
39
+ # Maven
40
+ target/
41
+
42
+ # JetBrains IDE
43
+ .idea/
44
+
45
+ # Unit test reports
46
+ TEST*.xml
47
+
48
+ # Generated by MacOS
49
+ .DS_Store
50
+
51
+ # Generated by Windows
52
+ Thumbs.db
53
+
54
+ # Applications
55
+ *.app
56
+ *.exe
57
+ *.war
58
+
59
+ # Large media files
60
+ *.mp4
61
+ *.tiff
62
+ *.avi
63
+ *.flv
64
+ *.mov
65
+ *.wmv
66
+
67
+ *.env
68
+
69
+ docs/build/
70
+
71
+ .vscode
72
+
73
+ # Unit test / coverage reports
74
+ htmlcov/
75
+ .tox/
76
+ .nox/
77
+ .coverage
78
+ .coverage.*
79
+ .cache
80
+ nosetests.xml
81
+ coverage.xml
82
+ *.cover
83
+ *.py,cover
84
+ .hypothesis/
85
+ .pytest_cache/
86
+ cover/
@@ -0,0 +1,6 @@
1
+ {
2
+ // Line 0 to 79 draw a ruler
3
+ "editor.rulers": [
4
+ 79
5
+ ],
6
+ }
@@ -0,0 +1,51 @@
1
+ WHITE="\033[1;37m"
2
+ GREEN="\033[1;32m"
3
+ YELLOW="\033[1;33m"
4
+ CLEAN="\033[0m"
5
+
6
+ install:
7
+ pip install --upgrade pip
8
+ pip install -r requirements.txt
9
+
10
+ install-dev: install
11
+ pip install -r requirements-dev.txt
12
+
13
+ test:
14
+ @if [ "$(module)" = "" ]; then\
15
+ echo $(WHITE)Starting tests for $(YELLOW)channel_app$(CLEAN)..$(CLEAN);\
16
+ coverage erase;\
17
+ coverage run -m unittest discover channel_app;\
18
+ fi
19
+
20
+ @if [ $(module) ]; then\
21
+ echo $(WHITE)Starting tests for $(YELLOW)channel_app.$(module)$(CLEAN) $(WHITE)module..$(CLEAN);\
22
+ coverage run -m unittest discover channel_app.$(module);\
23
+ fi
24
+
25
+ coverage:
26
+ @if [ "$(module)" = "" ]; then\
27
+ coverage report $(extra);\
28
+ fi;\
29
+
30
+ @if [ $(module) ]; then\
31
+ coverage report --include="channel_app/$(subst .,/,$(module))/*" $(extra);\
32
+ fi;\
33
+
34
+ coverage-html:
35
+ @if [ "$(module)" = "" ]; then\
36
+ coverage html;\
37
+ fi;\
38
+
39
+ @if [ $(module) ]; then\
40
+ coverage html --include="channel_app/$(subst .,/,$(module))/*";\
41
+ fi;\
42
+
43
+ @echo \\n$(GREEN)Detailed report generated successfully and it is accessible from \"file://$(PWD)/htmlcov/index.html\".
44
+
45
+ clean:
46
+ coverage erase
47
+ rm -rf htmlcov/
48
+ @echo $(GREEN)Coverage related data files cleaned up!$(CLEAN)
49
+
50
+ check: clean test coverage coverage-html
51
+ @echo $(GREEN)All tests passed!$(CLEAN)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: channel_app
3
- Version: 0.0.131
3
+ Version: 0.0.135
4
4
  Summary: Channel app for Sales Channels
5
5
  Home-page: https://github.com/akinon/channel_app
6
6
  Author: akinonteam
@@ -0,0 +1,2 @@
1
+ worker: celery -A tasks worker --loglevel INFO
2
+ beat: celery -A tasks beat --loglevel INFO
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "Sales Channel",
3
+ "description": "Sales Channel",
4
+ "scripts": {
5
+ "release": "sleep 3",
6
+ "build": "./build.sh"
7
+ },
8
+ "env": {},
9
+ "formation": {
10
+ "beat": {
11
+ "min": 1,
12
+ "max": 1
13
+ },
14
+ "worker": {
15
+ "min": 1,
16
+ "max": "auto"
17
+ },
18
+ "web": {
19
+ "min": 1,
20
+ "max": "auto"
21
+ }
22
+ },
23
+ "runtime": "python:3.8-alpine",
24
+ "addons": [
25
+ {
26
+ "plan": "redis",
27
+ "as": "BROKER"
28
+ },
29
+ {
30
+ "plan": "sentry"
31
+ }
32
+ ]
33
+ }
@@ -0,0 +1,14 @@
1
+ image: python:3.8.10
2
+
3
+ pipelines:
4
+ pull-requests:
5
+ '**':
6
+ - step:
7
+ name: Test
8
+ caches:
9
+ - pip
10
+ script:
11
+ - python -m pip install --upgrade setuptools
12
+ - make install && make install-dev
13
+ - make test
14
+ - make coverage
@@ -0,0 +1 @@
1
+ apk update && apk add python3-dev git && pip install -U --force-reinstall pip && pip install -r requirements.txt
@@ -20,6 +20,8 @@ class ProductService(object):
20
20
  content_type=ContentType.product.value) as omnitron_integration:
21
21
  products = omnitron_integration.do_action(
22
22
  key='get_inserted_products')
23
+
24
+ first_product_count = len(products)
23
25
 
24
26
  if add_mapped:
25
27
  products = products and omnitron_integration.do_action(
@@ -38,6 +40,12 @@ class ProductService(object):
38
40
  key='get_product_categories', objects=products)
39
41
 
40
42
  if not products:
43
+ if first_product_count:
44
+ omnitron_integration.batch_request.objects = None
45
+ self.batch_service(omnitron_integration.channel_id).to_fail(
46
+ omnitron_integration.batch_request
47
+ )
48
+
41
49
  return
42
50
 
43
51
  products: List[Product]
@@ -78,6 +86,8 @@ class ProductService(object):
78
86
  content_type=ContentType.product.value) as omnitron_integration:
79
87
  products = omnitron_integration.do_action(
80
88
  key='get_updated_products')
89
+
90
+ first_product_count = len(products)
81
91
 
82
92
  if add_mapped:
83
93
  products = products and omnitron_integration.do_action(
@@ -96,6 +106,12 @@ class ProductService(object):
96
106
  key='get_product_categories', objects=products)
97
107
 
98
108
  if not products:
109
+ if first_product_count:
110
+ omnitron_integration.batch_request.objects = None
111
+ self.batch_service(omnitron_integration.channel_id).to_fail(
112
+ omnitron_integration.batch_request
113
+ )
114
+
99
115
  return
100
116
 
101
117
  products: List[Product]
@@ -238,7 +238,9 @@ class OmnitronCommandInterface(CommandInterface):
238
238
  return formatted_data
239
239
 
240
240
  def check_run(self, is_ok, formatted_data):
241
- if is_ok and not formatted_data and self.is_batch_request:
241
+ if is_ok and not \
242
+ (formatted_data or self.failed_object_list) and \
243
+ self.is_batch_request:
242
244
  self.batch_service(self.integration.channel_id).to_done(
243
245
  self.integration.batch_request)
244
246
  return False
@@ -1,15 +1,14 @@
1
- from redis import Redis
2
1
  import unittest
3
2
  from unittest.mock import patch, Mock
4
-
3
+ from redis import Redis
5
4
  from channel_app.core.clients import OmnitronApiClient
6
5
  from omnisdk.exceptions import ValidationError
7
6
 
8
-
9
7
  class TestOmnitronApiClient(unittest.TestCase):
10
8
  """
11
- run:
12
- python -m unittest channel_app.core.tests.TestOmnitronApiClient
9
+ Test the OmnitronApiClient class.
10
+
11
+ run: python -m unittest channel_app.core.tests.test_clients.TestOmnitronApiClient
13
12
  """
14
13
  redis_con = Redis()
15
14
  omnitron_auth_url = "https://example.com/api/v1/auth/login/"
@@ -0,0 +1,16 @@
1
+ import unittest
2
+ from unittest.mock import MagicMock
3
+ from channel_app.core.commands import OmnitronCommandInterface
4
+
5
+
6
+ class BaseTestCaseMixin(unittest.TestCase):
7
+ mock_integration = MagicMock()
8
+ omnitron_command_interface = OmnitronCommandInterface(
9
+ integration=mock_integration
10
+ )
11
+
12
+ def setUp(self) -> None:
13
+ return super().setUp()
14
+
15
+ def tearDown(self) -> None:
16
+ return super().tearDown()