contact-message-local 0.0.3b4164__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.
- contact_message_local-0.0.3b4164/PKG-INFO +27 -0
- contact_message_local-0.0.3b4164/README.md +23 -0
- contact_message_local-0.0.3b4164/contact_message_local/__init__.py +0 -0
- contact_message_local-0.0.3b4164/contact_message_local/src/__init__.py +0 -0
- contact_message_local-0.0.3b4164/contact_message_local/src/constants_src_contact_message_local.py +52 -0
- contact_message_local-0.0.3b4164/contact_message_local/src/contact__message_local_enum.py +6 -0
- contact_message_local-0.0.3b4164/contact_message_local/src/contact_message_local.py +25 -0
- contact_message_local-0.0.3b4164/contact_message_local/src/pycallgraph.py +12 -0
- contact_message_local-0.0.3b4164/contact_message_local/src/version.py +1 -0
- contact_message_local-0.0.3b4164/contact_message_local/tests/__init__.py +0 -0
- contact_message_local-0.0.3b4164/contact_message_local/tests/conftest.py +25 -0
- contact_message_local-0.0.3b4164/contact_message_local/tests/constants/__init__.py +0 -0
- contact_message_local-0.0.3b4164/contact_message_local/tests/constants/constants_tests_contact_message_local.py +17 -0
- contact_message_local-0.0.3b4164/contact_message_local/tests/unit/__init__.py +0 -0
- contact_message_local-0.0.3b4164/contact_message_local/tests/unit/contact_message_local_constants_unit_test.py +109 -0
- contact_message_local-0.0.3b4164/contact_message_local/tests/unit/contact_message_local_unit_test.py +86 -0
- contact_message_local-0.0.3b4164/contact_message_local.egg-info/PKG-INFO +27 -0
- contact_message_local-0.0.3b4164/contact_message_local.egg-info/SOURCES.txt +22 -0
- contact_message_local-0.0.3b4164/contact_message_local.egg-info/dependency_links.txt +1 -0
- contact_message_local-0.0.3b4164/contact_message_local.egg-info/requires.txt +3 -0
- contact_message_local-0.0.3b4164/contact_message_local.egg-info/top_level.txt +1 -0
- contact_message_local-0.0.3b4164/pyproject.toml +31 -0
- contact_message_local-0.0.3b4164/setup.cfg +4 -0
- contact_message_local-0.0.3b4164/setup.py +84 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: contact-message-local
|
|
3
|
+
Version: 0.0.3b4164
|
|
4
|
+
Summary: PyPI contact-message-local Python Package owned by Circlez.ai
|
|
5
|
+
Home-page: https://github.com/circles-zone/contact--message-local-python-pacakge
|
|
6
|
+
Author: Circles
|
|
7
|
+
Author-email: info@circlez.ai
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Requires-Dist: our-object-local
|
|
13
|
+
Requires-Dist: logger-local
|
|
14
|
+
Requires-Dist: database-mysql-local
|
|
15
|
+
Dynamic: author
|
|
16
|
+
Dynamic: author-email
|
|
17
|
+
Dynamic: classifier
|
|
18
|
+
Dynamic: description
|
|
19
|
+
Dynamic: description-content-type
|
|
20
|
+
Dynamic: home-page
|
|
21
|
+
Dynamic: license
|
|
22
|
+
Dynamic: requires-dist
|
|
23
|
+
Dynamic: summary
|
|
24
|
+
|
|
25
|
+
PyPI contact-message-local Python Package owned by Circlez.ai
|
|
26
|
+
JIRA Work Item: https://circles-zone.atlassian.net/browse/BU-4164
|
|
27
|
+
GHA: https://github.com/circles-zone/contact--message-local-python-pacakge/actions
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# General
|
|
2
|
+
|
|
3
|
+
Unlike the README.md in the root directory, this is a README.md of this specific repo/package<br>
|
|
4
|
+
|
|
5
|
+
TODO Please update this README.md of this specific repo/package and not the README.md in the root directory based on the python-package-template repo<br>
|
|
6
|
+
|
|
7
|
+
## TODOs
|
|
8
|
+
|
|
9
|
+
TODO example of a TODO, please it with a real TODO<br>
|
|
10
|
+
|
|
11
|
+
## Versions
|
|
12
|
+
|
|
13
|
+
[pub] 0.0.1 Initial version (change the directories, files, setup.py, .github/workflows/*.yml)<br>
|
|
14
|
+
|
|
15
|
+
## Installing instructions
|
|
16
|
+
|
|
17
|
+
It's advised to use venv<br>
|
|
18
|
+
If you have Windows, it's also advised to use Windows Subsystem for Linux<br>
|
|
19
|
+
|
|
20
|
+
## Install dependencies
|
|
21
|
+
|
|
22
|
+
Run ./download-beta-sdk.sh from the bash terminal<br>
|
|
23
|
+
Run pip install -r requirements.txt from the bash terminal<br>
|
|
File without changes
|
|
File without changes
|
contact_message_local-0.0.3b4164/contact_message_local/src/constants_src_contact_message_local.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
from logger_local.LoggerComponentEnum import LoggerComponentEnum
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class ConstantsSrcContactMessageLocal:
|
|
6
|
+
"""This is a class of all the constants of Contact Message"""
|
|
7
|
+
|
|
8
|
+
# <THE_ENTITY>_MESSAGE_INFORU_API_TYPE_ID = <api-type-id>
|
|
9
|
+
|
|
10
|
+
DEVELOPER_EMAIL_ADDRESS: str = 'alon.n@circ.zone'
|
|
11
|
+
|
|
12
|
+
CONTACT_MESSAGE_LOCAL_PYTHON_CODE_COMPONENT_ID: int = 5000020
|
|
13
|
+
CONTACT_MESSAGE_LOCAL_PYTHON_TEST_COMPONENT_ID: int = 5000021
|
|
14
|
+
|
|
15
|
+
CONTACT_MESSAGE_LOCAL_PYTHON_COMPONENT_NAME = 'contact--message-local-python-pacakge code'
|
|
16
|
+
CONTACT_MESSAGE_LOCAL_PYTHON_TEST_COMPONENT_NAME = 'contact--message-local-python-pacakge test'
|
|
17
|
+
CONTACT_MESSAGE_LOCAL_CODE_LOGGER_INIT_OBJECT: dict[str, Any] = {
|
|
18
|
+
'component_id': CONTACT_MESSAGE_LOCAL_PYTHON_CODE_COMPONENT_ID,
|
|
19
|
+
'component_name': CONTACT_MESSAGE_LOCAL_PYTHON_COMPONENT_NAME,
|
|
20
|
+
'component_category': LoggerComponentEnum.ComponentCategory.Code.value,
|
|
21
|
+
'developer_email_address': DEVELOPER_EMAIL_ADDRESS
|
|
22
|
+
}
|
|
23
|
+
CONTACT_MESSAGE_LOCAL_TEST_LOGGER_INIT_OBJECT: dict[str, Any] = {
|
|
24
|
+
'component_id': CONTACT_MESSAGE_LOCAL_PYTHON_TEST_COMPONENT_ID,
|
|
25
|
+
'component_name': CONTACT_MESSAGE_LOCAL_PYTHON_TEST_COMPONENT_NAME,
|
|
26
|
+
'component_category': LoggerComponentEnum.ComponentCategory.Unit_Test.value,
|
|
27
|
+
'testing_framework': LoggerComponentEnum.testingFramework.pytest.value,
|
|
28
|
+
'developer_email_address': DEVELOPER_EMAIL_ADDRESS
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
UNKNOWN_CONTACT_MESSAGE_ID = 0
|
|
32
|
+
|
|
33
|
+
# TODO Please update if you need default values i.e. for testing
|
|
34
|
+
# DEFAULT_XXX_NAME = None
|
|
35
|
+
# DEFAULT_XXX_NAME = None
|
|
36
|
+
|
|
37
|
+
# <THE_ENTITY>_SCHEMA_NAME = '<entity>_schema'
|
|
38
|
+
# <THE_ENTITY>_TABLE_NAME = '<entity>_table'
|
|
39
|
+
# <THE_ENTITY>_VIEW_NAME = '<entity>_view'
|
|
40
|
+
# <THE_ENTITY>_ML_TABLE_NAME = '<entity>_ml_table' # TODO In case you don't use ML table, delete this
|
|
41
|
+
# <THE_ENTITY>_ML_VIEW_NAME = '<entity>_ml_view'
|
|
42
|
+
# <THE_ENTITY>_COLUMN_NAME = '<entity>_id'
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def get_logger_object(category: LoggerComponentEnum.ComponentCategory = LoggerComponentEnum.ComponentCategory.Code):
|
|
46
|
+
if category == LoggerComponentEnum.ComponentCategory.Code:
|
|
47
|
+
get_logger_object_result = dict(ConstantsSrcContactMessageLocal.CONTACT_MESSAGE_LOCAL_CODE_LOGGER_INIT_OBJECT)
|
|
48
|
+
elif category == LoggerComponentEnum.ComponentCategory.Unit_Test:
|
|
49
|
+
get_logger_object_result = dict(ConstantsSrcContactMessageLocal.CONTACT_MESSAGE_LOCAL_TEST_LOGGER_INIT_OBJECT)
|
|
50
|
+
else:
|
|
51
|
+
raise ValueError(f"unsupported category {category!r}")
|
|
52
|
+
return get_logger_object_result
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from our_object_local.our_object import OurObject
|
|
2
|
+
|
|
3
|
+
ENTITY_NAME = "Contact Message"
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ContactMessageLocal(OurObject):
|
|
7
|
+
|
|
8
|
+
# TODO Add all fields
|
|
9
|
+
fields = {
|
|
10
|
+
"message_id",
|
|
11
|
+
"display_as",
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
def __init__(self, entity_name=ENTITY_NAME, **kwargs):
|
|
15
|
+
super().__init__(entity_name, **kwargs)
|
|
16
|
+
|
|
17
|
+
def get_message_id(self) -> int:
|
|
18
|
+
"""The message this contact message belongs to, or None when it is unlinked."""
|
|
19
|
+
get_message_id_result = self.get("message_id")
|
|
20
|
+
return get_message_id_result
|
|
21
|
+
|
|
22
|
+
# Mandatory pure virtual method from OurObject
|
|
23
|
+
def get_name(self):
|
|
24
|
+
print(f"{ENTITY_NAME} get_name() self.fields.display_as={self.fields.display_as}")
|
|
25
|
+
return self.fields.display_as
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# https://stackoverflow.com/questions/582336/how-do-i-profile-a-python-script
|
|
2
|
+
from pycallgraph import PyCallGraph
|
|
3
|
+
from pycallgraph.output import GraphvizOutput
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def code_to_profile() -> None:
|
|
7
|
+
"""Replace the body with the code to profile."""
|
|
8
|
+
pass
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
with PyCallGraph(output=GraphvizOutput()):
|
|
12
|
+
code_to_profile()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
PACKAGE_VERSION = "0.0.0"
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import pytest
|
|
3
|
+
from unittest.mock import MagicMock, patch
|
|
4
|
+
|
|
5
|
+
os.environ.setdefault("BRAND_NAME", "circlez")
|
|
6
|
+
os.environ.setdefault("ENVIRONMENT_NAME", "local1")
|
|
7
|
+
os.environ.setdefault("RDS_HOSTNAME", "127.0.0.1")
|
|
8
|
+
os.environ.setdefault("RDS_USERNAME", "test")
|
|
9
|
+
os.environ.setdefault("RDS_PASSWORD", "test")
|
|
10
|
+
|
|
11
|
+
# Allow module-level Connector.connect("entity_type") in entity_types_local.py
|
|
12
|
+
# to succeed at collection time without a real MySQL host.
|
|
13
|
+
patch("database_mysql_local.connector.Connector.connect", return_value=MagicMock()).start()
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@pytest.fixture(autouse=True)
|
|
17
|
+
def skip_without_db():
|
|
18
|
+
"""Skip tests that require a live database connection in environments where
|
|
19
|
+
none is available (CI without RDS security group, local dev without DB)."""
|
|
20
|
+
import socket
|
|
21
|
+
host = os.environ.get("RDS_HOSTNAME", "")
|
|
22
|
+
try:
|
|
23
|
+
socket.getaddrinfo(host, 3306)
|
|
24
|
+
except socket.gaierror:
|
|
25
|
+
pytest.skip(f"No database host reachable at {host}")
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from ...src.constants_src_contact_message_local import ConstantsSrcContactMessageLocal
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ContactMessageLocalTestsConstants:
|
|
5
|
+
CONTACT_MESSAGE_LOCAL_PYTHON_TEST_COMPONENT_ID: int = (
|
|
6
|
+
ConstantsSrcContactMessageLocal.CONTACT_MESSAGE_LOCAL_PYTHON_TEST_COMPONENT_ID)
|
|
7
|
+
CONTACT_MESSAGE_LOCAL_PYTHON_TEST_COMPONENT_NAME = (
|
|
8
|
+
ConstantsSrcContactMessageLocal.CONTACT_MESSAGE_LOCAL_PYTHON_TEST_COMPONENT_NAME)
|
|
9
|
+
DEVELOPER_EMAIL_ADDRESS = ConstantsSrcContactMessageLocal.DEVELOPER_EMAIL_ADDRESS
|
|
10
|
+
|
|
11
|
+
# TODO Shall we add it to the class above
|
|
12
|
+
# TODO At this point of time we do not support camelCase in logger-local
|
|
13
|
+
# TODO Please add the framework you use
|
|
14
|
+
CONTACT_MESSAGE_LOCAL_TEST_LOGGER_INIT_OBJECT = dict(
|
|
15
|
+
ConstantsSrcContactMessageLocal.CONTACT_MESSAGE_LOCAL_TEST_LOGGER_INIT_OBJECT)
|
|
16
|
+
|
|
17
|
+
EXAMPLE_MESSAGE_ID: int = 1
|
|
File without changes
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from logger_local.LoggerLocal import Logger
|
|
3
|
+
from logger_local.LoggerComponentEnum import LoggerComponentEnum
|
|
4
|
+
|
|
5
|
+
from ...src.constants_src_contact_message_local import ConstantsSrcContactMessageLocal, get_logger_object
|
|
6
|
+
from ..constants.constants_tests_contact_message_local import ContactMessageLocalTestsConstants
|
|
7
|
+
|
|
8
|
+
CODE_OBJECT = ConstantsSrcContactMessageLocal.CONTACT_MESSAGE_LOCAL_CODE_LOGGER_INIT_OBJECT
|
|
9
|
+
TEST_OBJECT = ConstantsSrcContactMessageLocal.CONTACT_MESSAGE_LOCAL_TEST_LOGGER_INIT_OBJECT
|
|
10
|
+
CODE_OBJECT_KEYS = {"component_id", "component_name", "component_category", "developer_email_address"}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_component_ids_are_positive_and_differ():
|
|
14
|
+
code_component_id = ConstantsSrcContactMessageLocal.CONTACT_MESSAGE_LOCAL_PYTHON_CODE_COMPONENT_ID
|
|
15
|
+
test_component_id = ConstantsSrcContactMessageLocal.CONTACT_MESSAGE_LOCAL_PYTHON_TEST_COMPONENT_ID
|
|
16
|
+
|
|
17
|
+
assert code_component_id > 0
|
|
18
|
+
assert test_component_id > 0
|
|
19
|
+
assert code_component_id != test_component_id
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_logger_objects_use_the_component_ids_by_name():
|
|
23
|
+
assert CODE_OBJECT["component_id"] == ConstantsSrcContactMessageLocal.CONTACT_MESSAGE_LOCAL_PYTHON_CODE_COMPONENT_ID
|
|
24
|
+
assert TEST_OBJECT["component_id"] == ConstantsSrcContactMessageLocal.CONTACT_MESSAGE_LOCAL_PYTHON_TEST_COMPONENT_ID
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def test_code_logger_object_has_the_keys_create_logger_requires():
|
|
28
|
+
assert set(CODE_OBJECT) == CODE_OBJECT_KEYS
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def test_test_logger_object_has_the_code_keys_and_the_testing_framework():
|
|
32
|
+
assert set(TEST_OBJECT) == CODE_OBJECT_KEYS | {"testing_framework"}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def test_code_logger_object_has_the_code_name_and_category():
|
|
36
|
+
assert CODE_OBJECT["component_name"] == ConstantsSrcContactMessageLocal.CONTACT_MESSAGE_LOCAL_PYTHON_COMPONENT_NAME
|
|
37
|
+
assert CODE_OBJECT["component_category"] == LoggerComponentEnum.ComponentCategory.Code.value
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_test_logger_object_has_the_test_name_and_category():
|
|
41
|
+
assert TEST_OBJECT["component_name"] == ConstantsSrcContactMessageLocal.CONTACT_MESSAGE_LOCAL_PYTHON_TEST_COMPONENT_NAME
|
|
42
|
+
assert TEST_OBJECT["component_category"] == LoggerComponentEnum.ComponentCategory.Unit_Test.value
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@pytest.mark.parametrize("logger_object", [CODE_OBJECT, TEST_OBJECT])
|
|
46
|
+
def test_create_logger_accepts_each_logger_object(logger_object):
|
|
47
|
+
assert Logger.create_logger(object=dict(logger_object)) is not None
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def test_get_logger_object_without_an_argument_returns_the_code_object():
|
|
51
|
+
assert get_logger_object() == CODE_OBJECT
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def test_get_logger_object_returns_the_code_object_for_code():
|
|
55
|
+
assert get_logger_object(LoggerComponentEnum.ComponentCategory.Code) == CODE_OBJECT
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def test_get_logger_object_returns_the_test_object_for_unit_test():
|
|
59
|
+
assert get_logger_object(LoggerComponentEnum.ComponentCategory.Unit_Test) == TEST_OBJECT
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def test_get_logger_object_returns_a_copy():
|
|
63
|
+
returned_object = get_logger_object(LoggerComponentEnum.ComponentCategory.Unit_Test)
|
|
64
|
+
original_component_id = TEST_OBJECT["component_id"]
|
|
65
|
+
|
|
66
|
+
returned_object["component_id"] = original_component_id + 1
|
|
67
|
+
|
|
68
|
+
assert TEST_OBJECT["component_id"] == original_component_id
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@pytest.mark.parametrize("refused_category", [
|
|
72
|
+
"Code",
|
|
73
|
+
"Unit-Test",
|
|
74
|
+
" Code",
|
|
75
|
+
"CODE",
|
|
76
|
+
"code",
|
|
77
|
+
LoggerComponentEnum.ComponentCategory.E2E_Test,
|
|
78
|
+
LoggerComponentEnum.ComponentType.API,
|
|
79
|
+
LoggerComponentEnum.testingFramework.pytest,
|
|
80
|
+
None,
|
|
81
|
+
"",
|
|
82
|
+
0,
|
|
83
|
+
"*",
|
|
84
|
+
"p*",
|
|
85
|
+
"c*",
|
|
86
|
+
"*:*",
|
|
87
|
+
"cOdE",
|
|
88
|
+
"Code ",
|
|
89
|
+
"Unit_Test",
|
|
90
|
+
"E2E_Test",
|
|
91
|
+
True,
|
|
92
|
+
"UNIT-TEST",
|
|
93
|
+
"unit-test",
|
|
94
|
+
" Unit-Test",
|
|
95
|
+
"Unit-Test ",
|
|
96
|
+
"E2E-Test",
|
|
97
|
+
])
|
|
98
|
+
def test_get_logger_object_refuses_every_other_category(refused_category):
|
|
99
|
+
with pytest.raises(ValueError):
|
|
100
|
+
get_logger_object(refused_category)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def test_tests_constants_read_the_src_values():
|
|
104
|
+
assert ContactMessageLocalTestsConstants.CONTACT_MESSAGE_LOCAL_PYTHON_TEST_COMPONENT_ID == \
|
|
105
|
+
ConstantsSrcContactMessageLocal.CONTACT_MESSAGE_LOCAL_PYTHON_TEST_COMPONENT_ID
|
|
106
|
+
assert ContactMessageLocalTestsConstants.CONTACT_MESSAGE_LOCAL_PYTHON_TEST_COMPONENT_NAME == \
|
|
107
|
+
ConstantsSrcContactMessageLocal.CONTACT_MESSAGE_LOCAL_PYTHON_TEST_COMPONENT_NAME
|
|
108
|
+
assert ContactMessageLocalTestsConstants.DEVELOPER_EMAIL_ADDRESS == ConstantsSrcContactMessageLocal.DEVELOPER_EMAIL_ADDRESS
|
|
109
|
+
assert ContactMessageLocalTestsConstants.CONTACT_MESSAGE_LOCAL_TEST_LOGGER_INIT_OBJECT == TEST_OBJECT
|
contact_message_local-0.0.3b4164/contact_message_local/tests/unit/contact_message_local_unit_test.py
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# So we can run debugger without launch.json in VSCode
|
|
2
|
+
from dotenv import load_dotenv
|
|
3
|
+
load_dotenv() # Load environment variables before any imports that need them
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
import pytest
|
|
7
|
+
import sys
|
|
8
|
+
|
|
9
|
+
# from database_mysql_local.generic_crud import GenericCRUD
|
|
10
|
+
from logger_local.LoggerLocal import Logger
|
|
11
|
+
|
|
12
|
+
from ...src.contact_message_local import ContactMessageLocal
|
|
13
|
+
from ..constants.constants_tests_contact_message_local import ContactMessageLocalTestsConstants
|
|
14
|
+
|
|
15
|
+
# TODO Do not use Magic Numbers, please bring the test_*_id from the relevant package.
|
|
16
|
+
# Examples:
|
|
17
|
+
# TEST_API_TYPE_ID = ApisLocal.get_test_api_id()
|
|
18
|
+
# TEST_PROFILE_ID = ProfilesLocal.get_test_profile_id()
|
|
19
|
+
|
|
20
|
+
logger = Logger.create_logger(object=ContactMessageLocalTestsConstants.CONTACT_MESSAGE_LOCAL_TEST_LOGGER_INIT_OBJECT)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def test_something1():
|
|
24
|
+
logger.start("test some test")
|
|
25
|
+
example = ContactMessageLocal(is_test_data=True)
|
|
26
|
+
# TODO You can delete this print statement after you implement your test
|
|
27
|
+
print(example)
|
|
28
|
+
# TODO: implement your test using pytest
|
|
29
|
+
logger.end("test successful")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def test_somethings2():
|
|
33
|
+
logger.start("test some test")
|
|
34
|
+
example = ContactMessageLocal(is_test_data=True)
|
|
35
|
+
# TODO You can delete this print statement after you implement your test
|
|
36
|
+
print(example)
|
|
37
|
+
logger.end("test successful")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_something3():
|
|
41
|
+
logger.start("test some test")
|
|
42
|
+
example = ContactMessageLocal(is_test_data=True)
|
|
43
|
+
# TODO You can delete this print statement after you implement your test
|
|
44
|
+
print(example)
|
|
45
|
+
logger.end("test successful")
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# message_id
|
|
49
|
+
|
|
50
|
+
def test_message_id_is_a_contact_message_local_field():
|
|
51
|
+
"""message_id is declared, so it survives a fields-based conversion."""
|
|
52
|
+
assert "message_id" in ContactMessageLocal.fields
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def test_contact_message_local_carries_its_message_id():
|
|
56
|
+
"""A contact message knows which message it belongs to."""
|
|
57
|
+
message_id = ContactMessageLocalTestsConstants.EXAMPLE_MESSAGE_ID
|
|
58
|
+
contact_message_instance = ContactMessageLocal(message_id=message_id)
|
|
59
|
+
|
|
60
|
+
assert contact_message_instance.get_message_id() == message_id
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def test_contact_message_local_without_a_message_has_no_message_id():
|
|
64
|
+
"""A contact message that is not linked to a message returns None."""
|
|
65
|
+
contact_message_instance = ContactMessageLocal()
|
|
66
|
+
|
|
67
|
+
assert contact_message_instance.get_message_id() is None
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
# If we use only a call to some_test(), this can cause unexpected behavior, for example
|
|
71
|
+
# it can cause the test to be run multiple times simultaneously. This is why we use the following
|
|
72
|
+
# Which cause the test to be run only once with pytest:
|
|
73
|
+
if __name__ == "__main__":
|
|
74
|
+
pytest.main(sys.argv[1:])
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
# You can also run only specific test functions by using the following command:
|
|
78
|
+
# This example will run only some_test and some_test3
|
|
79
|
+
# Mark and click `ctrl + /` to uncomment the following code
|
|
80
|
+
# if __name__ == "__main__":
|
|
81
|
+
# # 'directory-with-the-same-name-as-the-repo/package_name_until_including_local_or_remote/tests/the_examples_local_test.py' is the relative path to the test file # noqa E501
|
|
82
|
+
# # 'some_test' and 'some_test3' are the names of the test functions we want to run
|
|
83
|
+
# pytest.main(
|
|
84
|
+
# ['directory-with-the-same-name-as-the-repo/package_name_until_including_local_or_remote/tests/the_examples_local_test.py::some_test',
|
|
85
|
+
# 'directory-with-the-same-name-as-the-repo/package_name_until_including_local_or_remote/tests/the_examples_local_test.py::some_test3']
|
|
86
|
+
# )
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: contact-message-local
|
|
3
|
+
Version: 0.0.3b4164
|
|
4
|
+
Summary: PyPI contact-message-local Python Package owned by Circlez.ai
|
|
5
|
+
Home-page: https://github.com/circles-zone/contact--message-local-python-pacakge
|
|
6
|
+
Author: Circles
|
|
7
|
+
Author-email: info@circlez.ai
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Requires-Dist: our-object-local
|
|
13
|
+
Requires-Dist: logger-local
|
|
14
|
+
Requires-Dist: database-mysql-local
|
|
15
|
+
Dynamic: author
|
|
16
|
+
Dynamic: author-email
|
|
17
|
+
Dynamic: classifier
|
|
18
|
+
Dynamic: description
|
|
19
|
+
Dynamic: description-content-type
|
|
20
|
+
Dynamic: home-page
|
|
21
|
+
Dynamic: license
|
|
22
|
+
Dynamic: requires-dist
|
|
23
|
+
Dynamic: summary
|
|
24
|
+
|
|
25
|
+
PyPI contact-message-local Python Package owned by Circlez.ai
|
|
26
|
+
JIRA Work Item: https://circles-zone.atlassian.net/browse/BU-4164
|
|
27
|
+
GHA: https://github.com/circles-zone/contact--message-local-python-pacakge/actions
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
setup.py
|
|
4
|
+
contact_message_local/__init__.py
|
|
5
|
+
contact_message_local.egg-info/PKG-INFO
|
|
6
|
+
contact_message_local.egg-info/SOURCES.txt
|
|
7
|
+
contact_message_local.egg-info/dependency_links.txt
|
|
8
|
+
contact_message_local.egg-info/requires.txt
|
|
9
|
+
contact_message_local.egg-info/top_level.txt
|
|
10
|
+
contact_message_local/src/__init__.py
|
|
11
|
+
contact_message_local/src/constants_src_contact_message_local.py
|
|
12
|
+
contact_message_local/src/contact__message_local_enum.py
|
|
13
|
+
contact_message_local/src/contact_message_local.py
|
|
14
|
+
contact_message_local/src/pycallgraph.py
|
|
15
|
+
contact_message_local/src/version.py
|
|
16
|
+
contact_message_local/tests/__init__.py
|
|
17
|
+
contact_message_local/tests/conftest.py
|
|
18
|
+
contact_message_local/tests/constants/__init__.py
|
|
19
|
+
contact_message_local/tests/constants/constants_tests_contact_message_local.py
|
|
20
|
+
contact_message_local/tests/unit/__init__.py
|
|
21
|
+
contact_message_local/tests/unit/contact_message_local_constants_unit_test.py
|
|
22
|
+
contact_message_local/tests/unit/contact_message_local_unit_test.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
contact_message_local
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# This file should be in the future instead of setup.py
|
|
2
|
+
# https://python-poetry.org/docs/pyproject
|
|
3
|
+
# https://stackoverflow.com/questions/78048223/adding-folder-with-data-with-pyproject-toml
|
|
4
|
+
# https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license
|
|
5
|
+
|
|
6
|
+
# This file is mandatory for the `poetry version patch`
|
|
7
|
+
|
|
8
|
+
# It seems we need to copy this file also to serverless-com repo, as required by dialog-workflow-python-package
|
|
9
|
+
|
|
10
|
+
[build-system]
|
|
11
|
+
requires = ["setuptools>=61.0"]
|
|
12
|
+
build-backend = "setuptools.build_meta"
|
|
13
|
+
|
|
14
|
+
[tool.pytest.ini_options]
|
|
15
|
+
pythonpath = ["."]
|
|
16
|
+
|
|
17
|
+
[tool.poetry]
|
|
18
|
+
# TODO: Please update the name, similar to storage-local (suffix -local)
|
|
19
|
+
name = "<project-name>"
|
|
20
|
+
# TODO After the b (beta), you should add the Jira Work Item ID (was generated by Jira). If you run sdk-local Makec.ps1 it should do it for you.
|
|
21
|
+
# I believe we are still using the version from setup.py and not from here until Potery will work
|
|
22
|
+
version = "0.0.3b4164" # https://pypi.org/project/<project-name> i.e. https://pypi.org/project/storage-local/
|
|
23
|
+
description = "<project-name> Python Package"
|
|
24
|
+
readme = "README.md"
|
|
25
|
+
authors = [
|
|
26
|
+
"Circlez.ai <info@circlez.ai>",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[tool.poetry.dev-dependencies]
|
|
30
|
+
pytest = "^8.0"
|
|
31
|
+
pytest-cov = "^5.0"
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# serverless.com repo "python -m build" works without setup.py
|
|
2
|
+
# Should update package_dir if not using our recommended directory structure
|
|
3
|
+
|
|
4
|
+
import setuptools
|
|
5
|
+
|
|
6
|
+
# TODO: Change the PACKAGE_NAME to the package's name - Either xxx-local or
|
|
7
|
+
# xxx-remote (without the -python-package suffix). Only lowercase, no
|
|
8
|
+
# underlines.
|
|
9
|
+
# Used by pypa/gh-action-pypi-publish
|
|
10
|
+
# Package Name should be identical to the inner directory name
|
|
11
|
+
# Changing the package name here, will cause a change in the package directory
|
|
12
|
+
# name as well
|
|
13
|
+
# PACKAGE_NAME should be singular if handling only one instance
|
|
14
|
+
# PACKAGE_NAME should not include the word "main"
|
|
15
|
+
|
|
16
|
+
# e.g.: queue-local, without python-package suffix
|
|
17
|
+
PACKAGE_NAME = "contact-message-local"
|
|
18
|
+
|
|
19
|
+
package_dir = PACKAGE_NAME.replace("-", "_")
|
|
20
|
+
# If we need backward-compatible:
|
|
21
|
+
# old_package_dir = "old_package_name"
|
|
22
|
+
|
|
23
|
+
PACKAGE_DESCRIPTION = f"PyPI {PACKAGE_NAME} Python Package owned by Circlez.ai"
|
|
24
|
+
NEW_LINE = "\n"
|
|
25
|
+
|
|
26
|
+
setuptools.setup(
|
|
27
|
+
license='MIT',
|
|
28
|
+
name=PACKAGE_NAME,
|
|
29
|
+
# Increase this number every time you make a change
|
|
30
|
+
# want to publish. After 0.0.9 switch to 0.0.10 and not 0.1.0
|
|
31
|
+
# version can't be 0.0.
|
|
32
|
+
# If you find yourself increasing the version in more than one patch number (it might indicate there are multiple branches, which you should submit their PRs before your PR) # noqa: E501
|
|
33
|
+
# Updating the b<work-item-id] done automatically by makec.ps1 / make_py.ps1
|
|
34
|
+
# TODO add the Jira Work Item (Jira Issue) number after the version, i.e., 0.0.1b2432
|
|
35
|
+
# TODO: According to GitFlow, in the Feature Branch, please update after the letter 'b' the Jira Work Item ID, and in the exceptional case you can't get a Jira Work Item directly or using the Slack Channel, please use the PR number. Semantic Version simver.org
|
|
36
|
+
version="0.0.3b4164", # https://pypi.org/project/contact-message-local/
|
|
37
|
+
author="Circles",
|
|
38
|
+
author_email="info@circlez.ai",
|
|
39
|
+
description=f"{PACKAGE_DESCRIPTION}",
|
|
40
|
+
# long_description=f"{description}",
|
|
41
|
+
long_description=(
|
|
42
|
+
f"{PACKAGE_DESCRIPTION}" + NEW_LINE
|
|
43
|
+
+ "JIRA Work Item: "
|
|
44
|
+
+ "https://circles-zone.atlassian.net/browse/BU-4164" + NEW_LINE
|
|
45
|
+
+ "GHA: "
|
|
46
|
+
+ "https://github.com/circles-zone/"
|
|
47
|
+
+ "contact--message-local-python-pacakge/actions"
|
|
48
|
+
),
|
|
49
|
+
|
|
50
|
+
long_description_content_type='text/markdown',
|
|
51
|
+
url="https://github.com/circles-zone/contact--message-local-python-pacakge",
|
|
52
|
+
# packages=[package_dir],
|
|
53
|
+
# packages=[package_dir, old_package_dir],
|
|
54
|
+
packages=setuptools.find_packages(),
|
|
55
|
+
|
|
56
|
+
# I'm not sure we need package_dir
|
|
57
|
+
# package_dir={package_dir: f'{package_dir}/src'},
|
|
58
|
+
# TODO Unfortunately in event-main-local-restapi there are no
|
|
59
|
+
# repo-directory and no package directory (flat directory structure)
|
|
60
|
+
# package_dir={package_dir: f'src'},
|
|
61
|
+
|
|
62
|
+
# package_dir={package_dir: f'{package_dir}/src',
|
|
63
|
+
# old_package_dir: f'{package_dir}/src'},
|
|
64
|
+
package_data={package_dir: ['*.py']},
|
|
65
|
+
classifiers=[
|
|
66
|
+
"Programming Language :: Python :: 3",
|
|
67
|
+
# https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license
|
|
68
|
+
# TODO Fix all repos, especially the Python templates
|
|
69
|
+
# License :: MIT AND (Apache-2.0 OR BSD-2-Clause)
|
|
70
|
+
"Operating System :: OS Independent",
|
|
71
|
+
],
|
|
72
|
+
# Do not add packages needed only for tests, i.e., packages for get_test_xxx(
|
|
73
|
+
# TODO: Update which packages to include with this package in production
|
|
74
|
+
# (dependencies) - Not for development/testing
|
|
75
|
+
install_requires=[
|
|
76
|
+
'our-object-local',
|
|
77
|
+
# TODO: in -remote package, please use logger-remote instead.
|
|
78
|
+
'logger-local',
|
|
79
|
+
'database-mysql-local',
|
|
80
|
+
# TODO: In -local package, please uncomment the line below. In -remote packages, please delete this line. # noqa E501
|
|
81
|
+
# 'smart-datastore-local',
|
|
82
|
+
# 'logzio-python-handler>=4.1.2', # https://pypi.org/project/logzio-python-handler/ # noqa E501
|
|
83
|
+
]
|
|
84
|
+
)
|