contentstack-utils 1.1.0__tar.gz → 1.2.2__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.
- {contentstack_utils-1.1.0 → contentstack_utils-1.2.2}/LICENSE +1 -1
- {contentstack_utils-1.1.0 → contentstack_utils-1.2.2}/PKG-INFO +21 -9
- {contentstack_utils-1.1.0 → contentstack_utils-1.2.2}/README.md +22 -7
- {contentstack_utils-1.1.0 → contentstack_utils-1.2.2}/contentstack_utils.egg-info/PKG-INFO +21 -9
- contentstack_utils-1.2.2/contentstack_utils.egg-info/SOURCES.txt +18 -0
- {contentstack_utils-1.1.0 → contentstack_utils-1.2.2}/setup.py +1 -2
- contentstack_utils-1.2.2/tests/test_default_opt_others.py +44 -0
- contentstack_utils-1.2.2/tests/test_gql_to_html_func.py +37 -0
- contentstack_utils-1.2.2/tests/test_helper_node_to_html.py +61 -0
- contentstack_utils-1.2.2/tests/test_item_types.py +13 -0
- contentstack_utils-1.2.2/tests/test_metadata.py +53 -0
- contentstack_utils-1.2.2/tests/test_option_render_mark.py +52 -0
- contentstack_utils-1.2.2/tests/test_render_default_options.py +82 -0
- contentstack_utils-1.2.2/tests/test_render_options.py +36 -0
- contentstack_utils-1.2.2/tests/test_style_type.py +26 -0
- contentstack_utils-1.2.2/tests/test_util_srte.py +114 -0
- contentstack_utils-1.2.2/tests/test_utils.py +80 -0
- contentstack_utils-1.1.0/contentstack_utils.egg-info/SOURCES.txt +0 -7
- {contentstack_utils-1.1.0 → contentstack_utils-1.2.2}/contentstack_utils.egg-info/dependency_links.txt +0 -0
- {contentstack_utils-1.1.0 → contentstack_utils-1.2.2}/contentstack_utils.egg-info/top_level.txt +0 -0
- {contentstack_utils-1.1.0 → contentstack_utils-1.2.2}/setup.cfg +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright
|
|
1
|
+
Copyright 2023 Contentstack
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
4
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: contentstack_utils
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Summary: contentstack_utils is a Utility package for Contentstack headless CMS with an API-first approach.
|
|
5
5
|
Home-page: https://github.com/contentstack/contentstack-utils-python
|
|
6
6
|
Author: contentstack
|
|
7
7
|
License: MIT
|
|
8
|
-
Platform: UNKNOWN
|
|
9
8
|
Classifier: License :: OSI Approved :: MIT License
|
|
10
9
|
Classifier: Operating System :: OS Independent
|
|
11
10
|
Classifier: Intended Audience :: Developers
|
|
@@ -51,7 +50,7 @@ If you are using Contentstack Python SDK in your project by running the followin
|
|
|
51
50
|
## For the specific version
|
|
52
51
|
|
|
53
52
|
```python
|
|
54
|
-
pip install Contentstack==1.
|
|
53
|
+
pip install Contentstack==1.5.1
|
|
55
54
|
```
|
|
56
55
|
|
|
57
56
|
## Usage
|
|
@@ -66,11 +65,9 @@ To render embedded items on the front-end, use the renderContents function, and
|
|
|
66
65
|
from contentstack_utils.utils import Utils
|
|
67
66
|
from contentstack_utils.render.options import Options
|
|
68
67
|
|
|
69
|
-
json_array # should be type of dictionary or list
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
callback = Options()
|
|
73
|
-
response = Utils.render_content(rte_content, json_array, callback)
|
|
68
|
+
json_array = {} # should be type of dictionary or list
|
|
69
|
+
option = Options()
|
|
70
|
+
response = Utils.render_content('html_string', json_array, option)
|
|
74
71
|
print(response)
|
|
75
72
|
|
|
76
73
|
```
|
|
@@ -126,9 +123,24 @@ query = stack.content_type("content_type_uid").query()
|
|
|
126
123
|
result = query.find()
|
|
127
124
|
if result is not None and 'entries' in result:
|
|
128
125
|
entry = result['entries']
|
|
129
|
-
for item in
|
|
126
|
+
for item in entry:
|
|
130
127
|
option = Option()
|
|
131
128
|
Utils.json_to_html(item, ['paragraph_text'], option)
|
|
132
129
|
```
|
|
133
130
|
|
|
131
|
+
## GraphQL SRTE
|
|
132
|
+
|
|
133
|
+
To get supercharged items from multiple entries, you need to provide the stack API key, delivery token, environment name, and content type’s UID.
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
import contentstack
|
|
134
137
|
|
|
138
|
+
stack = contentstack.Stack('api_key','delivery_token','environment')
|
|
139
|
+
query = stack.content_type("content_type_uid").query()
|
|
140
|
+
result = query.find()
|
|
141
|
+
if result is not None and 'entries' in result:
|
|
142
|
+
entry = result['entries']
|
|
143
|
+
for item in entry:
|
|
144
|
+
option = Option()
|
|
145
|
+
GQL.json_to_html(item, ['paragraph_text'], option)
|
|
146
|
+
```
|
|
@@ -31,7 +31,7 @@ If you are using Contentstack Python SDK in your project by running the followin
|
|
|
31
31
|
## For the specific version
|
|
32
32
|
|
|
33
33
|
```python
|
|
34
|
-
pip install Contentstack==1.
|
|
34
|
+
pip install Contentstack==1.5.1
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
## Usage
|
|
@@ -46,11 +46,9 @@ To render embedded items on the front-end, use the renderContents function, and
|
|
|
46
46
|
from contentstack_utils.utils import Utils
|
|
47
47
|
from contentstack_utils.render.options import Options
|
|
48
48
|
|
|
49
|
-
json_array # should be type of dictionary or list
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
callback = Options()
|
|
53
|
-
response = Utils.render_content(rte_content, json_array, callback)
|
|
49
|
+
json_array = {} # should be type of dictionary or list
|
|
50
|
+
option = Options()
|
|
51
|
+
response = Utils.render_content('html_string', json_array, option)
|
|
54
52
|
print(response)
|
|
55
53
|
|
|
56
54
|
```
|
|
@@ -106,7 +104,24 @@ query = stack.content_type("content_type_uid").query()
|
|
|
106
104
|
result = query.find()
|
|
107
105
|
if result is not None and 'entries' in result:
|
|
108
106
|
entry = result['entries']
|
|
109
|
-
for item in
|
|
107
|
+
for item in entry:
|
|
110
108
|
option = Option()
|
|
111
109
|
Utils.json_to_html(item, ['paragraph_text'], option)
|
|
112
110
|
```
|
|
111
|
+
|
|
112
|
+
## GraphQL SRTE
|
|
113
|
+
|
|
114
|
+
To get supercharged items from multiple entries, you need to provide the stack API key, delivery token, environment name, and content type’s UID.
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
import contentstack
|
|
118
|
+
|
|
119
|
+
stack = contentstack.Stack('api_key','delivery_token','environment')
|
|
120
|
+
query = stack.content_type("content_type_uid").query()
|
|
121
|
+
result = query.find()
|
|
122
|
+
if result is not None and 'entries' in result:
|
|
123
|
+
entry = result['entries']
|
|
124
|
+
for item in entry:
|
|
125
|
+
option = Option()
|
|
126
|
+
GQL.json_to_html(item, ['paragraph_text'], option)
|
|
127
|
+
```
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: contentstack-utils
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Summary: contentstack_utils is a Utility package for Contentstack headless CMS with an API-first approach.
|
|
5
5
|
Home-page: https://github.com/contentstack/contentstack-utils-python
|
|
6
6
|
Author: contentstack
|
|
7
7
|
License: MIT
|
|
8
|
-
Platform: UNKNOWN
|
|
9
8
|
Classifier: License :: OSI Approved :: MIT License
|
|
10
9
|
Classifier: Operating System :: OS Independent
|
|
11
10
|
Classifier: Intended Audience :: Developers
|
|
@@ -51,7 +50,7 @@ If you are using Contentstack Python SDK in your project by running the followin
|
|
|
51
50
|
## For the specific version
|
|
52
51
|
|
|
53
52
|
```python
|
|
54
|
-
pip install Contentstack==1.
|
|
53
|
+
pip install Contentstack==1.5.1
|
|
55
54
|
```
|
|
56
55
|
|
|
57
56
|
## Usage
|
|
@@ -66,11 +65,9 @@ To render embedded items on the front-end, use the renderContents function, and
|
|
|
66
65
|
from contentstack_utils.utils import Utils
|
|
67
66
|
from contentstack_utils.render.options import Options
|
|
68
67
|
|
|
69
|
-
json_array # should be type of dictionary or list
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
callback = Options()
|
|
73
|
-
response = Utils.render_content(rte_content, json_array, callback)
|
|
68
|
+
json_array = {} # should be type of dictionary or list
|
|
69
|
+
option = Options()
|
|
70
|
+
response = Utils.render_content('html_string', json_array, option)
|
|
74
71
|
print(response)
|
|
75
72
|
|
|
76
73
|
```
|
|
@@ -126,9 +123,24 @@ query = stack.content_type("content_type_uid").query()
|
|
|
126
123
|
result = query.find()
|
|
127
124
|
if result is not None and 'entries' in result:
|
|
128
125
|
entry = result['entries']
|
|
129
|
-
for item in
|
|
126
|
+
for item in entry:
|
|
130
127
|
option = Option()
|
|
131
128
|
Utils.json_to_html(item, ['paragraph_text'], option)
|
|
132
129
|
```
|
|
133
130
|
|
|
131
|
+
## GraphQL SRTE
|
|
132
|
+
|
|
133
|
+
To get supercharged items from multiple entries, you need to provide the stack API key, delivery token, environment name, and content type’s UID.
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
import contentstack
|
|
134
137
|
|
|
138
|
+
stack = contentstack.Stack('api_key','delivery_token','environment')
|
|
139
|
+
query = stack.content_type("content_type_uid").query()
|
|
140
|
+
result = query.find()
|
|
141
|
+
if result is not None and 'entries' in result:
|
|
142
|
+
entry = result['entries']
|
|
143
|
+
for item in entry:
|
|
144
|
+
option = Option()
|
|
145
|
+
GQL.json_to_html(item, ['paragraph_text'], option)
|
|
146
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
contentstack_utils.egg-info/PKG-INFO
|
|
5
|
+
contentstack_utils.egg-info/SOURCES.txt
|
|
6
|
+
contentstack_utils.egg-info/dependency_links.txt
|
|
7
|
+
contentstack_utils.egg-info/top_level.txt
|
|
8
|
+
tests/test_default_opt_others.py
|
|
9
|
+
tests/test_gql_to_html_func.py
|
|
10
|
+
tests/test_helper_node_to_html.py
|
|
11
|
+
tests/test_item_types.py
|
|
12
|
+
tests/test_metadata.py
|
|
13
|
+
tests/test_option_render_mark.py
|
|
14
|
+
tests/test_render_default_options.py
|
|
15
|
+
tests/test_render_options.py
|
|
16
|
+
tests/test_style_type.py
|
|
17
|
+
tests/test_util_srte.py
|
|
18
|
+
tests/test_utils.py
|
|
@@ -15,7 +15,7 @@ setup(
|
|
|
15
15
|
long_description_content_type="text/markdown",
|
|
16
16
|
url="https://github.com/contentstack/contentstack-utils-python",
|
|
17
17
|
license='MIT',
|
|
18
|
-
version='1.
|
|
18
|
+
version='1.2.2',
|
|
19
19
|
install_requires=[
|
|
20
20
|
|
|
21
21
|
],
|
|
@@ -32,6 +32,5 @@ setup(
|
|
|
32
32
|
'Programming Language :: Python :: 3.8',
|
|
33
33
|
'Programming Language :: Python :: 3.9',
|
|
34
34
|
],
|
|
35
|
-
|
|
36
35
|
python_requires='>=3.6',
|
|
37
36
|
)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
import unittest
|
|
4
|
+
|
|
5
|
+
from contentstack_utils.helper.metadata import Metadata, StyleType
|
|
6
|
+
from contentstack_utils.render import options
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def read_mock_path():
|
|
10
|
+
to_json = os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
|
11
|
+
'mocks', 'embedded_items_without_title.json')
|
|
12
|
+
with open(to_json) as file:
|
|
13
|
+
to_json = json.load(file)
|
|
14
|
+
return to_json['entries'][0]['_embedded_items']['rich_text_editor']
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class TestDefaultOptOther(unittest.TestCase):
|
|
18
|
+
|
|
19
|
+
def test_get_default_options_render_option_block_without_title(self):
|
|
20
|
+
to_json = read_mock_path()
|
|
21
|
+
dictionary = to_json[0]
|
|
22
|
+
default_opt = options.Options()
|
|
23
|
+
metadata = Metadata("Hi sample entry for embedding", "entry", 'bltb5a04880fbb74f26', 'samplect',
|
|
24
|
+
StyleType.BLOCK, "this is outer html", 'samplect attributes')
|
|
25
|
+
result = default_opt.render_options(dictionary, metadata)
|
|
26
|
+
self.assertEqual('<div><p>removed_for_security_reasons</p><div><p>Content type: <span>samplect</span></p></div>', result)
|
|
27
|
+
|
|
28
|
+
def test_get_render_option_asset_without_title_link(self):
|
|
29
|
+
to_json = read_mock_path()
|
|
30
|
+
dictionary = to_json[0]
|
|
31
|
+
default_opt = options.Options()
|
|
32
|
+
metadata = Metadata("Hi sample entry for embedding", "entry", 'bltb5a04880fbb74f26', 'samplect',
|
|
33
|
+
StyleType.DISPLAY, "this is outer html", 'samplect attributes')
|
|
34
|
+
result = default_opt.render_options(dictionary, metadata)
|
|
35
|
+
self.assertEqual('<img src=/sample-entry-one alt=samplect_filename/>', result)
|
|
36
|
+
|
|
37
|
+
def test_get_render_option_asset_without_title_filename_link(self):
|
|
38
|
+
to_json = read_mock_path()
|
|
39
|
+
dictionary = to_json[1]
|
|
40
|
+
default_opt = options.Options()
|
|
41
|
+
metadata = Metadata("Hi sample entry for embedding", "entry", 'b5a04880fbb74f26', 'samplect',
|
|
42
|
+
StyleType.DISPLAY, "this is outer html", 'samplect attributes')
|
|
43
|
+
result = default_opt.render_options(dictionary, metadata)
|
|
44
|
+
self.assertEqual('<img src=/sample-entry-one alt=removed_for_security_reasons/>', result)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
import unittest
|
|
4
|
+
|
|
5
|
+
from contentstack_utils.gql import GQL
|
|
6
|
+
from contentstack_utils.render.options import Options
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def mock_entry():
|
|
10
|
+
path_gql = 'mocks/graphqlmock'
|
|
11
|
+
file = os.path.dirname(os.path.abspath(__file__))
|
|
12
|
+
gql_entry = os.path.join(file, path_gql, 'content.json')
|
|
13
|
+
with open(gql_entry) as file:
|
|
14
|
+
return json.load(file)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class TestGQLToHtml(unittest.TestCase):
|
|
18
|
+
srt_zero = '<p></p><div><p>Abcd Three</p><div><p>Content type: <span></span></p></div>'
|
|
19
|
+
|
|
20
|
+
def setUp(self):
|
|
21
|
+
print("logger for convert style")
|
|
22
|
+
|
|
23
|
+
def test_read_entry(self):
|
|
24
|
+
entry = mock_entry()
|
|
25
|
+
self.assertIsNotNone(entry)
|
|
26
|
+
|
|
27
|
+
def test_read_entry_uid(self):
|
|
28
|
+
entry = mock_entry()
|
|
29
|
+
self.assertEqual('sameple_uid', entry['srte']['json'][0]['uid'])
|
|
30
|
+
|
|
31
|
+
def test_gql_to_html(self):
|
|
32
|
+
entry = mock_entry()
|
|
33
|
+
option = Options()
|
|
34
|
+
path_keys = ['srte']
|
|
35
|
+
GQL.json_to_html(entry, path_keys, option)
|
|
36
|
+
self.assertEqual(entry['srte'][0],
|
|
37
|
+
'<p></p><div><p>Abcd Three</p><div><p>Content type: <span></span></p></div>')
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
from contentstack_utils.helper.node_to_html import NodeToHtml
|
|
4
|
+
from contentstack_utils.render.options import Options
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class TestHelperNodeToHtml(unittest.TestCase):
|
|
8
|
+
node_dict = {
|
|
9
|
+
"text": "Lorem ipsum dolor sit amet"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
def setUp(self):
|
|
13
|
+
print("Test Helper Class Node To Html")
|
|
14
|
+
|
|
15
|
+
def test_test_helper_node_superscript(self):
|
|
16
|
+
option = Options()
|
|
17
|
+
what_does_it_returns = NodeToHtml.text_node_to_html(self.node_dict, option)
|
|
18
|
+
print(what_does_it_returns)
|
|
19
|
+
self.assertEqual("Lorem ipsum dolor sit amet", what_does_it_returns)
|
|
20
|
+
|
|
21
|
+
def test_test_helper_node_subscript(self):
|
|
22
|
+
option = Options()
|
|
23
|
+
what_does_it_returns = NodeToHtml.text_node_to_html(self.node_dict, option)
|
|
24
|
+
print(what_does_it_returns)
|
|
25
|
+
self.assertEqual("Lorem ipsum dolor sit amet", what_does_it_returns)
|
|
26
|
+
|
|
27
|
+
def test_test_helper_node_inline_code(self):
|
|
28
|
+
option = Options()
|
|
29
|
+
what_does_it_returns = NodeToHtml.text_node_to_html(self.node_dict, option)
|
|
30
|
+
print(what_does_it_returns)
|
|
31
|
+
self.assertEqual("Lorem ipsum dolor sit amet", what_does_it_returns)
|
|
32
|
+
|
|
33
|
+
def test_test_helper_node_strikethrough(self):
|
|
34
|
+
option = Options()
|
|
35
|
+
what_does_it_returns = NodeToHtml.text_node_to_html(self.node_dict, option)
|
|
36
|
+
print(what_does_it_returns)
|
|
37
|
+
self.assertEqual("Lorem ipsum dolor sit amet", what_does_it_returns)
|
|
38
|
+
|
|
39
|
+
def test_test_helper_node_underline(self):
|
|
40
|
+
option = Options()
|
|
41
|
+
what_does_it_returns = NodeToHtml.text_node_to_html(self.node_dict, option)
|
|
42
|
+
print(what_does_it_returns)
|
|
43
|
+
self.assertEqual("Lorem ipsum dolor sit amet", what_does_it_returns)
|
|
44
|
+
|
|
45
|
+
def test_test_helper_node_italic(self):
|
|
46
|
+
option = Options()
|
|
47
|
+
what_does_it_returns = NodeToHtml.text_node_to_html(self.node_dict, option)
|
|
48
|
+
print(what_does_it_returns)
|
|
49
|
+
self.assertEqual("Lorem ipsum dolor sit amet", what_does_it_returns)
|
|
50
|
+
|
|
51
|
+
def test_test_helper_node_bold(self):
|
|
52
|
+
option = Options()
|
|
53
|
+
what_does_it_returns = NodeToHtml.text_node_to_html(self.node_dict, option)
|
|
54
|
+
print(what_does_it_returns)
|
|
55
|
+
self.assertEqual("Lorem ipsum dolor sit amet", what_does_it_returns)
|
|
56
|
+
|
|
57
|
+
def test_test_helper_node_undefined(self):
|
|
58
|
+
option = Options()
|
|
59
|
+
what_does_it_returns = NodeToHtml.text_node_to_html(self.node_dict, option)
|
|
60
|
+
print(what_does_it_returns)
|
|
61
|
+
self.assertEqual("Lorem ipsum dolor sit amet", what_does_it_returns)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from contentstack_utils.embedded.item_type import ItemType
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class TestItemType(unittest.TestCase):
|
|
6
|
+
|
|
7
|
+
def test_item_type_entry(self):
|
|
8
|
+
typeof = ItemType.ENTRY
|
|
9
|
+
self.assertEqual('entry', typeof.value)
|
|
10
|
+
|
|
11
|
+
def test_item_type_asset(self):
|
|
12
|
+
typeof = ItemType.ASSET
|
|
13
|
+
self.assertEqual('asset', typeof.value)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from contentstack_utils.embedded.styletype import StyleType
|
|
3
|
+
from contentstack_utils.helper.metadata import Metadata
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class TestMetadata(unittest.TestCase):
|
|
7
|
+
|
|
8
|
+
def setUp(self):
|
|
9
|
+
self.metadata = Metadata('product', 'entry', 'blt87483473746', 'products',
|
|
10
|
+
StyleType.BLOCK, 'text_for_outer_html', 'attributes_is_string_for, now')
|
|
11
|
+
|
|
12
|
+
def test_metadata_mojo(self):
|
|
13
|
+
self.assertIsNotNone(self.metadata)
|
|
14
|
+
|
|
15
|
+
def test_metadata_object_text(self):
|
|
16
|
+
self.assertIsNotNone(self.metadata.get_text)
|
|
17
|
+
|
|
18
|
+
def test_metadata_object_attributes(self):
|
|
19
|
+
self.assertIsNotNone(self.metadata.get_attributes)
|
|
20
|
+
|
|
21
|
+
def test_metadata_object_outer_html(self):
|
|
22
|
+
self.assertIsNotNone(self.metadata.outer_html)
|
|
23
|
+
|
|
24
|
+
def test_metadata_item_type(self):
|
|
25
|
+
self.assertIsNotNone(self.metadata.get_item_type)
|
|
26
|
+
|
|
27
|
+
def test_metadata_item_uid(self):
|
|
28
|
+
self.assertIsNotNone(self.metadata.get_item_uid)
|
|
29
|
+
|
|
30
|
+
def test_metadata_content_type_uid(self):
|
|
31
|
+
self.assertIsNotNone(self.metadata.get_content_type_uid)
|
|
32
|
+
|
|
33
|
+
def test_metadata_style_type(self):
|
|
34
|
+
self.assertIsNotNone(self.metadata.get_style_type)
|
|
35
|
+
|
|
36
|
+
def test_metadata_object_text_value(self):
|
|
37
|
+
self.assertEqual('product', self.metadata.get_text)
|
|
38
|
+
|
|
39
|
+
def test_outer_html(self):
|
|
40
|
+
self.assertEqual('text_for_outer_html', self.metadata.get_outer_html)
|
|
41
|
+
|
|
42
|
+
def test_metadata_item_type_value(self):
|
|
43
|
+
self.assertEqual('entry', self.metadata.get_item_type)
|
|
44
|
+
|
|
45
|
+
def test_metadata_item_uid_value(self):
|
|
46
|
+
self.assertEqual('blt87483473746', self.metadata.get_item_uid)
|
|
47
|
+
|
|
48
|
+
def test_metadata_content_type_uid_value(self):
|
|
49
|
+
self.assertEqual('products', self.metadata.get_content_type_uid)
|
|
50
|
+
|
|
51
|
+
def test_metadata_style_type_value(self):
|
|
52
|
+
self.assertEqual('block', self.metadata.get_style_type.value)
|
|
53
|
+
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
import unittest
|
|
4
|
+
from contentstack_utils import Utils
|
|
5
|
+
from contentstack_utils.render.options import Options
|
|
6
|
+
from tests.mocks.supercharged.results import Results
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class TestOptionRenderMark(unittest.TestCase):
|
|
10
|
+
|
|
11
|
+
def setUp(self):
|
|
12
|
+
print("print for getting started option render mark")
|
|
13
|
+
|
|
14
|
+
def test_option_render_mark_superscript_supercharged_stringify(self):
|
|
15
|
+
what_does_it_returns = Options.render_mark("superscript", "some_string_for_example")
|
|
16
|
+
print(what_does_it_returns)
|
|
17
|
+
self.assertEqual("<sup>some_string_for_example</sup>", what_does_it_returns)
|
|
18
|
+
|
|
19
|
+
def test_option_render_mark_subscript_supercharged_stringify(self):
|
|
20
|
+
what_does_it_returns = Options.render_mark("subscript", "some_string_for_example")
|
|
21
|
+
print(what_does_it_returns)
|
|
22
|
+
self.assertEqual("<sub>some_string_for_example</sub>", what_does_it_returns)
|
|
23
|
+
|
|
24
|
+
def test_option_render_mark_inline_code_supercharged_stringify(self):
|
|
25
|
+
what_does_it_returns = Options.render_mark("inlineCode", "some_string_for_example")
|
|
26
|
+
print(what_does_it_returns)
|
|
27
|
+
self.assertEqual("<span>some_string_for_example</span>", what_does_it_returns)
|
|
28
|
+
|
|
29
|
+
def test_option_render_mark_strikethrough_supercharged_stringify(self):
|
|
30
|
+
what_does_it_returns = Options.render_mark("strikethrough", "some_string_for_example")
|
|
31
|
+
print(what_does_it_returns)
|
|
32
|
+
self.assertEqual("<strike>some_string_for_example</strike>", what_does_it_returns)
|
|
33
|
+
|
|
34
|
+
def test_option_render_mark_underline_supercharged_stringify(self):
|
|
35
|
+
what_does_it_returns = Options.render_mark("underline", "some_string_for_example")
|
|
36
|
+
print(what_does_it_returns)
|
|
37
|
+
self.assertEqual("<u>some_string_for_example</u>", what_does_it_returns)
|
|
38
|
+
|
|
39
|
+
def test_option_render_mark_italic_supercharged_stringify(self):
|
|
40
|
+
what_does_it_returns = Options.render_mark("italic", "some_string_for_example")
|
|
41
|
+
print(what_does_it_returns)
|
|
42
|
+
self.assertEqual("<em>some_string_for_example</em>", what_does_it_returns)
|
|
43
|
+
|
|
44
|
+
def test_option_render_mark_bold_supercharged_stringify(self):
|
|
45
|
+
what_does_it_returns = Options.render_mark("bold", "some_string_for_example")
|
|
46
|
+
print(what_does_it_returns)
|
|
47
|
+
self.assertEqual("<strong>some_string_for_example</strong>", what_does_it_returns)
|
|
48
|
+
|
|
49
|
+
def test_option_render_mark_undefined_supercharged_stringify(self):
|
|
50
|
+
what_does_it_returns = Options.render_mark("", "some_string_for_example")
|
|
51
|
+
print(what_does_it_returns)
|
|
52
|
+
self.assertEqual("some_string_for_example", what_does_it_returns)
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
import unittest
|
|
4
|
+
|
|
5
|
+
from contentstack_utils.helper.metadata import Metadata, StyleType
|
|
6
|
+
from contentstack_utils.render import options
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _is_json(file):
|
|
10
|
+
try:
|
|
11
|
+
json.dumps(file)
|
|
12
|
+
return True
|
|
13
|
+
except ValueError:
|
|
14
|
+
return False
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def read_mock_path():
|
|
18
|
+
to_json = os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
|
19
|
+
'mocks', 'embedded_items.json')
|
|
20
|
+
with open(to_json) as file:
|
|
21
|
+
to_json = json.load(file)
|
|
22
|
+
return to_json['entries'][0]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class TestRenderDefaultOption(unittest.TestCase):
|
|
26
|
+
|
|
27
|
+
def test_read_json_file_by_absolute_path(self):
|
|
28
|
+
self.assertIsNotNone(read_mock_path())
|
|
29
|
+
|
|
30
|
+
def test_read_json_file_by_content_path(self):
|
|
31
|
+
result = _is_json("/tests/mocks/embedded_items.json")
|
|
32
|
+
instance = isinstance(result, bool)
|
|
33
|
+
self.assertTrue(instance, 'this is to check the bool value')
|
|
34
|
+
|
|
35
|
+
def test_get_title_or_uid(self):
|
|
36
|
+
should_return_title = options._title_or_uid(read_mock_path())
|
|
37
|
+
self.assertEqual("Entry one", should_return_title, "It should match dictionary title")
|
|
38
|
+
|
|
39
|
+
def test_get_asset_title_or_uid(self):
|
|
40
|
+
should_return_title = options._asset_title_or_uid(read_mock_path())
|
|
41
|
+
self.assertEqual("Entry one", should_return_title, "It should match dictionary title")
|
|
42
|
+
|
|
43
|
+
def test_get_default_options_render_option_block(self):
|
|
44
|
+
dictionary = read_mock_path()['_embedded_items']['rich_text_editor'][0]
|
|
45
|
+
default_opt = options.Options()
|
|
46
|
+
metadata = Metadata("Hi sample entry for embedding", "entry", 'bltb5a04880fbb74f26', 'samplect',
|
|
47
|
+
StyleType.BLOCK, "this is outer html", 'samplect attributes')
|
|
48
|
+
result = default_opt.render_options(dictionary, metadata)
|
|
49
|
+
self.assertEqual("<div><p>Hi sample entry for embedding</p><div><p>Content type: "
|
|
50
|
+
"<span>samplect</span></p></div>", result)
|
|
51
|
+
|
|
52
|
+
def test_get_default_options_render_option_inline(self):
|
|
53
|
+
dictionary = read_mock_path()['_embedded_items']['rich_text_editor'][0]
|
|
54
|
+
default_opt = options.Options()
|
|
55
|
+
metadata = Metadata("this is sample text", "entry", 'blt8928738723', 'products',
|
|
56
|
+
StyleType.INLINE, "this is outer html", 'sample attributes')
|
|
57
|
+
result = default_opt.render_options(dictionary, metadata)
|
|
58
|
+
self.assertEqual('<span>Hi sample entry for embedding</span>', result)
|
|
59
|
+
|
|
60
|
+
def test_get_default_options_render_option_link(self):
|
|
61
|
+
dictionary = read_mock_path()['_embedded_items']['rich_text_editor'][0]
|
|
62
|
+
default_opt = options.Options()
|
|
63
|
+
metadata = Metadata("this is sample text", "entry", 'blt8928738723', 'products',
|
|
64
|
+
StyleType.LINK, "this is outer html", 'sample attributes')
|
|
65
|
+
result = default_opt.render_options(dictionary, metadata)
|
|
66
|
+
self.assertEqual('<a href=/sample-entry-one>Hi sample entry for embedding</a>', result)
|
|
67
|
+
|
|
68
|
+
def test_get_default_options_render_asset_display(self):
|
|
69
|
+
dictionary = read_mock_path()['_embedded_items']['rich_text_editor'][0]
|
|
70
|
+
default_opt = options.Options()
|
|
71
|
+
metadata = Metadata("this is sample text", "asset", 'blt8928738723', 'products',
|
|
72
|
+
StyleType.DISPLAY, "this is outer html", 'sample attributes')
|
|
73
|
+
result = default_opt.render_options(dictionary, metadata)
|
|
74
|
+
self.assertEqual('<img src=/sample-entry-one alt=Hi sample entry for embedding/>', result)
|
|
75
|
+
|
|
76
|
+
def test_get_default_options_render_asset_none(self):
|
|
77
|
+
dictionary = read_mock_path()['_embedded_items']['rich_text_editor'][0]
|
|
78
|
+
default_opt = options.Options()
|
|
79
|
+
metadata = Metadata("this is sample text", "asset", 'blt8928738723', 'products',
|
|
80
|
+
StyleType.DOWNLOAD, "this is outer html", 'sample attributes')
|
|
81
|
+
result = default_opt.render_options(dictionary, metadata)
|
|
82
|
+
self.assertEqual('<a href=/sample-entry-one>Hi sample entry for embedding</a>', result)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import unittest
|
|
3
|
+
import json
|
|
4
|
+
from contentstack_utils.helper.metadata import Metadata, StyleType
|
|
5
|
+
from contentstack_utils.render import options
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def read_mock_path(path):
|
|
9
|
+
path_to_json = os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
|
10
|
+
'mocks', path)
|
|
11
|
+
return path_to_json
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class TestRenderOption(unittest.TestCase):
|
|
15
|
+
|
|
16
|
+
def test_get_default_options_render_asset_display(self):
|
|
17
|
+
json_array = None
|
|
18
|
+
path = read_mock_path('embedded_items.json')
|
|
19
|
+
with open(path) as file:
|
|
20
|
+
json_array = json.load(file)
|
|
21
|
+
dictionary = json_array['entries'][0]['_embedded_items']['rich_text_editor'][0]
|
|
22
|
+
default_opt = options.Options()
|
|
23
|
+
metadata = Metadata("this is sample text", "asset", 'blt8928738723', 'products',
|
|
24
|
+
StyleType.DISPLAY, "this is outer html", 'sample attributes')
|
|
25
|
+
result = default_opt.render_options(dictionary, metadata)
|
|
26
|
+
self.assertEqual('<img src=/sample-entry-one alt=Hi sample entry for embedding/>', result)
|
|
27
|
+
|
|
28
|
+
def test_get_default_options_render_no_style(self):
|
|
29
|
+
with open('tests/mocks/embedded_items.json', 'r') as f:
|
|
30
|
+
array = json.load(f)
|
|
31
|
+
dictionary = array['entries'][0]['_embedded_items']['rich_text_editor'][0]
|
|
32
|
+
default_opt = options.Options()
|
|
33
|
+
metadata = Metadata("this is sample text", "asset", 'blt8928738723', 'products',
|
|
34
|
+
StyleType.DOWNLOAD, "this is outer html", 'sample attributes')
|
|
35
|
+
result = default_opt.render_options(dictionary, metadata)
|
|
36
|
+
self.assertEqual('<a href=/sample-entry-one>Hi sample entry for embedding</a>', result)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
from contentstack_utils.embedded.styletype import StyleType
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class TestStyleType(unittest.TestCase):
|
|
7
|
+
|
|
8
|
+
def test_style_type_block(self):
|
|
9
|
+
style = StyleType.BLOCK
|
|
10
|
+
self.assertEqual('block', style.value)
|
|
11
|
+
|
|
12
|
+
def test_style_type_inline(self):
|
|
13
|
+
style = StyleType.INLINE
|
|
14
|
+
self.assertEqual('inline', style.value)
|
|
15
|
+
|
|
16
|
+
def test_style_type_link(self):
|
|
17
|
+
style = StyleType.LINK
|
|
18
|
+
self.assertEqual('link', style.value)
|
|
19
|
+
|
|
20
|
+
def test_style_type_display(self):
|
|
21
|
+
style = StyleType.DISPLAY
|
|
22
|
+
self.assertEqual('display', style.value)
|
|
23
|
+
|
|
24
|
+
def test_style_type_downloadable(self):
|
|
25
|
+
style = StyleType.DOWNLOAD
|
|
26
|
+
self.assertEqual('download', style.value)
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
import unittest
|
|
4
|
+
from contentstack_utils import Utils
|
|
5
|
+
from contentstack_utils.render.options import Options
|
|
6
|
+
from tests.mocks.supercharged.results import Results
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def __is_json(file):
|
|
10
|
+
try:
|
|
11
|
+
json.dumps(file)
|
|
12
|
+
return True
|
|
13
|
+
except ValueError:
|
|
14
|
+
return False
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def load_mock():
|
|
18
|
+
path = os.path.join(
|
|
19
|
+
os.path.dirname(os.path.abspath(__file__)),
|
|
20
|
+
'mocks/supercharged', 'supercharged.json')
|
|
21
|
+
with open(path) as file:
|
|
22
|
+
return json.load(file)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class TestSuperchargedUtils(unittest.TestCase):
|
|
26
|
+
global _json_data # Note that the PyCharm warnings are not actual python errors
|
|
27
|
+
|
|
28
|
+
def setUp(self):
|
|
29
|
+
self._json_data = load_mock()
|
|
30
|
+
|
|
31
|
+
def test_plaintext_in_supercharged_dict_to_html(self):
|
|
32
|
+
array_str = ['plaintext']
|
|
33
|
+
Utils.json_to_html(self._json_data, array_str, Options())
|
|
34
|
+
self.assertEqual(Results.plainTextHtml, self._json_data['plaintext'])
|
|
35
|
+
|
|
36
|
+
def test_plaintext_in_supercharged_list_to_html(self):
|
|
37
|
+
array_str = ['plaintext_array']
|
|
38
|
+
Utils.json_to_html(self._json_data, array_str, Options())
|
|
39
|
+
self.assertEqual(Results.plainTextHtml, self._json_data['plaintext_array'][0])
|
|
40
|
+
|
|
41
|
+
def test_paragraph_in_supercharged_dict_to_html(self):
|
|
42
|
+
array_str = ['paragraph']
|
|
43
|
+
Utils.json_to_html([self._json_data], array_str, Options())
|
|
44
|
+
self.assertEqual(Results.paragraphHtml, self._json_data['paragraph'])
|
|
45
|
+
|
|
46
|
+
def test_h1_in_supercharged_dict_to_html(self):
|
|
47
|
+
array_str = ['h_one']
|
|
48
|
+
Utils.json_to_html([self._json_data], array_str, Options())
|
|
49
|
+
self.assertEqual(Results.h1Html, self._json_data['h_one'])
|
|
50
|
+
|
|
51
|
+
def test_h2_in_supercharged_dict_to_html(self):
|
|
52
|
+
array_str = ['h_two']
|
|
53
|
+
Utils.json_to_html([self._json_data], array_str, Options())
|
|
54
|
+
self.assertEqual(Results.h2Html, self._json_data['h_two'])
|
|
55
|
+
|
|
56
|
+
def test_h3_in_supercharged_dict_to_html(self):
|
|
57
|
+
array_str = ['h_three']
|
|
58
|
+
Utils.json_to_html([self._json_data], array_str, Options())
|
|
59
|
+
self.assertEqual(Results.h3Html, self._json_data['h_three'])
|
|
60
|
+
|
|
61
|
+
def test_h4_in_supercharged_dict_to_html(self):
|
|
62
|
+
array_str = ['h_four']
|
|
63
|
+
Utils.json_to_html([self._json_data], array_str, Options())
|
|
64
|
+
self.assertEqual(Results.h4Html, self._json_data['h_four'])
|
|
65
|
+
|
|
66
|
+
def test_h5_in_supercharged_dict_to_html(self):
|
|
67
|
+
array_str = ['h_five']
|
|
68
|
+
Utils.json_to_html([self._json_data], array_str, Options())
|
|
69
|
+
self.assertEqual(Results.h5Html, self._json_data['h_five'])
|
|
70
|
+
|
|
71
|
+
def test_h6_in_supercharged_dict_to_html(self):
|
|
72
|
+
array_str = ['h_six']
|
|
73
|
+
Utils.json_to_html([self._json_data], array_str, Options())
|
|
74
|
+
self.assertEqual(Results.h6Html, self._json_data['h_six'])
|
|
75
|
+
|
|
76
|
+
def test_order_list_in_supercharged_dict_to_html(self):
|
|
77
|
+
array_str = ['order_list']
|
|
78
|
+
Utils.json_to_html([self._json_data], array_str, Options())
|
|
79
|
+
self.assertEqual(Results.orderListHtml, self._json_data['order_list'])
|
|
80
|
+
|
|
81
|
+
def test_un_order_list_in_supercharged_dict_to_html(self):
|
|
82
|
+
array_str = ['un_order_list']
|
|
83
|
+
Utils.json_to_html([self._json_data], array_str, Options())
|
|
84
|
+
self.assertEqual(Results.unorderListHtml, self._json_data['un_order_list'])
|
|
85
|
+
|
|
86
|
+
def test_image_list_in_supercharged_dict_to_html(self):
|
|
87
|
+
array_str = ['img']
|
|
88
|
+
Utils.json_to_html([self._json_data], array_str, Options())
|
|
89
|
+
self.assertEqual(Results.imgHtml, self._json_data['img'])
|
|
90
|
+
|
|
91
|
+
def test_table_list_in_supercharged_dict_to_html(self):
|
|
92
|
+
array_str = ['table']
|
|
93
|
+
Utils.json_to_html([self._json_data], array_str, Options())
|
|
94
|
+
self.assertEqual(Results.tableHtml, self._json_data['table'])
|
|
95
|
+
|
|
96
|
+
def test_blockquote_list_in_supercharged_dict_to_html(self):
|
|
97
|
+
array_str = ['blockquote']
|
|
98
|
+
Utils.json_to_html([self._json_data], array_str, Options())
|
|
99
|
+
self.assertEqual(Results.blockquoteHtml, self._json_data['blockquote'])
|
|
100
|
+
|
|
101
|
+
def test_code_list_in_supercharged_dict_to_html(self):
|
|
102
|
+
array_str = ['code']
|
|
103
|
+
Utils.json_to_html([self._json_data], array_str, Options())
|
|
104
|
+
self.assertEqual(Results.codeHtml, self._json_data['code'])
|
|
105
|
+
|
|
106
|
+
def test_linkin_list_in_supercharged_dict_to_html(self):
|
|
107
|
+
array_str = ['link']
|
|
108
|
+
Utils.json_to_html([self._json_data], array_str, Options())
|
|
109
|
+
self.assertEqual(Results.linkInPHtml, self._json_data['link'])
|
|
110
|
+
|
|
111
|
+
# def test_reference_list_in_supercharged_dict_to_html(self):
|
|
112
|
+
# array_str = ['reference']
|
|
113
|
+
# Utils.json_to_html([self._json_data], array_str, Options())
|
|
114
|
+
# self.assertEqual(Results.linkInPHtml, self._json_data['reference'])
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
import unittest
|
|
4
|
+
|
|
5
|
+
from contentstack_utils.render.options import Options
|
|
6
|
+
from contentstack_utils.utils import Utils
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _is_json(file):
|
|
10
|
+
try:
|
|
11
|
+
json.dumps(file)
|
|
12
|
+
return True
|
|
13
|
+
except ValueError:
|
|
14
|
+
return False
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def read_mock_path(path):
|
|
18
|
+
path_to_json = os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
|
19
|
+
'mocks', path)
|
|
20
|
+
return path_to_json
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class TestUtility(unittest.TestCase):
|
|
24
|
+
|
|
25
|
+
def test_cover_valid_json(self):
|
|
26
|
+
valid = _is_json(_is_json("outfile"))
|
|
27
|
+
self.assertTrue(valid)
|
|
28
|
+
|
|
29
|
+
def test_cover_render_fn_if_entry_obj_is_dict(self):
|
|
30
|
+
key_path = ['global_rich_multiple.group.rich_text_editor',
|
|
31
|
+
'global_rich_multiple.group'
|
|
32
|
+
'.rich_text_editor_multiple']
|
|
33
|
+
path = read_mock_path('multiple_rich_text_content.json')
|
|
34
|
+
with open(path) as file:
|
|
35
|
+
entry_list = json.load(file)['entries'][0]
|
|
36
|
+
option = Options()
|
|
37
|
+
return_value = Utils.render(entry_list, key_path, option)
|
|
38
|
+
self.assertIsNone(return_value)
|
|
39
|
+
|
|
40
|
+
def test_cover_render_fn_if_entry_obj_is_list(self):
|
|
41
|
+
key_path = ['global_rich_multiple.group.rich_text_editor',
|
|
42
|
+
'global_rich_multiple.group'
|
|
43
|
+
'.rich_text_editor_multiple']
|
|
44
|
+
path = read_mock_path('multiple_rich_text_content.json')
|
|
45
|
+
with open(path) as file:
|
|
46
|
+
entry_list = json.load(file)['entries']
|
|
47
|
+
option = Options()
|
|
48
|
+
return_value = Utils.render(entry_list, key_path, option)
|
|
49
|
+
self.assertIsNone(return_value)
|
|
50
|
+
|
|
51
|
+
def test_if_entry_object_render_content_asset(self):
|
|
52
|
+
path = read_mock_path('multiple_rich_text_content.json')
|
|
53
|
+
with open(path) as file:
|
|
54
|
+
json_array = json.load(file)
|
|
55
|
+
entry_list = json_array['entries'][0]
|
|
56
|
+
callback = Options()
|
|
57
|
+
rte_content = "<p>Global multiple group 1</p><figure class=\"embedded-asset\" " \
|
|
58
|
+
"data-redactor-type=\"embed\" data-widget-code=\"\" " \
|
|
59
|
+
"data-sys-asset-filelink=\"https://dev16-images.contentstack.com/v3/assets" \
|
|
60
|
+
"/11.jpg\" " \
|
|
61
|
+
"data-sys-asset-uid=\"7324a68403ee7281\" data-sys-asset-filename=\"11.jpg\" " \
|
|
62
|
+
"data-sys-asset-contenttype=\"image/jpeg\" type=\"asset\" " \
|
|
63
|
+
"sys-style-type=\"display\"></figure>"
|
|
64
|
+
response = Utils.render_content(rte_content, entry_list, callback, )
|
|
65
|
+
# self.assertEqual('<p>Global multiple group 1</p><img '
|
|
66
|
+
# 'src=https://dev16-images.contentstack.com/v3/assets/'
|
|
67
|
+
# '11.jpg alt=11.jpg/>', response)
|
|
68
|
+
|
|
69
|
+
def test_if_entry_object_render_content_entry(self):
|
|
70
|
+
path = read_mock_path('multiple_rich_text_content.json')
|
|
71
|
+
with open(path) as file:
|
|
72
|
+
json_array = json.load(file)
|
|
73
|
+
entry_list = json_array['entries'][0]
|
|
74
|
+
option = Options()
|
|
75
|
+
rte_content = "<p><a data-sys-entry-uid=\"1c9e75e3608f8c6b\" data-sys-entry-locale=\"en-us\" " \
|
|
76
|
+
"data-sys-content-type-uid=\"0_solve\" sys-style-type=\"link\" data-sys-can-edit=\"true\" " \
|
|
77
|
+
"class=\"embedded-entry\" type=\"entry\" href=\"/untitled\" title=\"Entry 001 123\">Global " \
|
|
78
|
+
"multiple modular 1</a></p>"
|
|
79
|
+
response = Utils.render_content(rte_content, entry_list, option)
|
|
80
|
+
self.assertEqual('<p><a href=/untitled>Entry 001 123</a></p>', response)
|
|
File without changes
|
{contentstack_utils-1.1.0 → contentstack_utils-1.2.2}/contentstack_utils.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|