square-administration 3.0.1__py3-none-any.whl → 3.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,7 +12,7 @@ from square_database_structure.square import global_string_database_name
12
12
  from square_database_structure.square.authentication import (
13
13
  global_string_schema_name as global_string_schema_name_authentication,
14
14
  )
15
- from square_database_structure.square.authentication.tables import UserCredential
15
+ from square_database_structure.square.authentication.tables import UserProfile
16
16
  from square_database_structure.square.greeting import global_string_schema_name
17
17
  from square_database_structure.square.greeting.tables import Greeting
18
18
 
@@ -77,33 +77,29 @@ async def get_all_greetings_v0(
77
77
  for x in response["data"]["main"]
78
78
  if x[Greeting.user_id.name] is not None
79
79
  }
80
- user_credentials_response = global_object_square_database_helper.get_rows_v0(
80
+ user_profile_response = global_object_square_database_helper.get_rows_v0(
81
81
  database_name=global_string_database_name,
82
82
  schema_name=global_string_schema_name_authentication,
83
- table_name=UserCredential.__tablename__,
83
+ table_name=UserProfile.__tablename__,
84
84
  filters=FiltersV0(
85
85
  root={
86
- UserCredential.user_id.name: FilterConditionsV0(
87
- in_=list(all_user_ids)
88
- )
86
+ UserProfile.user_id.name: FilterConditionsV0(in_=list(all_user_ids))
89
87
  }
90
88
  ),
91
89
  columns=[
92
- UserCredential.user_id.name,
93
- UserCredential.user_credential_username.name,
90
+ UserProfile.user_id.name,
91
+ UserProfile.user_profile_username.name,
94
92
  ],
95
93
  )["data"]["main"]
96
- user_credentials_map = {
97
- x[UserCredential.user_id.name]: x[
98
- UserCredential.user_credential_username.name
99
- ]
100
- for x in user_credentials_response
94
+ user_map = {
95
+ x[UserProfile.user_id.name]: x[UserProfile.user_profile_username.name]
96
+ for x in user_profile_response
101
97
  }
102
98
  response_clone = response
103
99
  response_clone["data"]["main"] = [
104
100
  {
105
101
  **greeting,
106
- UserCredential.user_credential_username.name: user_credentials_map.get(
102
+ UserProfile.user_profile_username.name: user_map.get(
107
103
  greeting[Greeting.user_id.name]
108
104
  ),
109
105
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: square-administration
3
- Version: 3.0.1
3
+ Version: 3.1.0
4
4
  Summary: common business layer for my personal server.
5
5
  Home-page: https://github.com/thepmsquare/square_administration
6
6
  Author: thePmSquare
@@ -18,6 +18,8 @@ Requires-Dist: fastapi>=0.104.1
18
18
  Requires-Dist: pydantic>=2.5.3
19
19
  Requires-Dist: requests>=2.32.3
20
20
  Requires-Dist: bcrypt>=4.2.0
21
+ Requires-Dist: pytest>=8.0.0
22
+ Requires-Dist: httpx>=0.27.2
21
23
  Requires-Dist: square-commons>=1.0.0
22
24
  Requires-Dist: square-logger>=1.0.0
23
25
  Requires-Dist: square-database-helper>=2.0.0
@@ -42,6 +44,15 @@ pip install square_administration
42
44
 
43
45
  ## changelog
44
46
 
47
+ ### v3.1.0
48
+
49
+ - add pytest as dependency.
50
+ - add dummy test case.
51
+
52
+ ### v3.0.2
53
+
54
+ - update logic to get usernames for non-anonymous greetings in get_all_greetings_v0.
55
+
45
56
  ### v3.0.1
46
57
 
47
58
  - add logging decorator to all functions.
@@ -8,10 +8,13 @@ square_administration/pydantic_models/authentication.py,sha256=QEfM5ezG45hc_qATX
8
8
  square_administration/pydantic_models/core.py,sha256=HUMrBmfKrXeL-126gE5j2povdVmktn8XLg2tHEdeXTk,344
9
9
  square_administration/routes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  square_administration/routes/authentication.py,sha256=vOkuAmnPkTl-PSDmSkyui2tvhFxvo0WzMAAuz3st-QY,16053
11
- square_administration/routes/core.py,sha256=65_FIZilintZvbHx7r25UQbgN-oKdQ92-Nv3kpwKX6s,5374
11
+ square_administration/routes/core.py,sha256=lKI1yAZG4LYKk-Z0pgdFwKW3wSl0ArziTylEKvp4DD0,5233
12
12
  square_administration/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  square_administration/utils/common.py,sha256=Uk2clDugVI8U6-bgjs77fxC4DuqmJEJ_IznBs1jAtWc,350
14
- square_administration-3.0.1.dist-info/METADATA,sha256=aviG8xNbrRwAs9SfhngddFLisn1_7RY3jsFgmYH2dec,2223
15
- square_administration-3.0.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
16
- square_administration-3.0.1.dist-info/top_level.txt,sha256=8WFipDrMQUPRDo5AvipxU1YK3wZtWZyCUMWaR416zAw,22
17
- square_administration-3.0.1.dist-info/RECORD,,
14
+ tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
+ tests/conftest.py,sha256=WU4jzo4E6M0E2U-DkrnUAwlW8G54DmNS4KydLceDhiU,446
16
+ tests/test_1.py,sha256=TKBO9xomDrIGJMKoBQsPK6TrJtAZp9aYv-d-SQNzgPA,479
17
+ square_administration-3.1.0.dist-info/METADATA,sha256=b8vram0yxkRiAGxCxRmHTcuD-al-SIWadZ0-CoQNOww,2443
18
+ square_administration-3.1.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
19
+ square_administration-3.1.0.dist-info/top_level.txt,sha256=tyroqpdXXQAiA7Y_V1wCqPPt6nnS_orcY9txLeHjm1s,28
20
+ square_administration-3.1.0.dist-info/RECORD,,
tests/__init__.py ADDED
File without changes
tests/conftest.py ADDED
@@ -0,0 +1,11 @@
1
+ import pytest
2
+
3
+
4
+ @pytest.fixture
5
+ def set_env(monkeypatch):
6
+ monkeypatch.setenv("SQUARE_DATABASE_PROTOCOL", "http")
7
+ monkeypatch.setenv("SQUARE_DATABASE_IP", "raspi.thepmsquare.com")
8
+ monkeypatch.setenv("SQUARE_DATABASE_PORT", "20010")
9
+ monkeypatch.setenv("SQUARE_AUTHENTICATION_PROTOCOL", "http")
10
+ monkeypatch.setenv("SQUARE_AUTHENTICATION_IP", "raspi.thepmsquare.com")
11
+ monkeypatch.setenv("SQUARE_AUTHENTICATION_PORT", "20011")
tests/test_1.py ADDED
@@ -0,0 +1,16 @@
1
+ from fastapi.testclient import TestClient
2
+ from square_commons import get_api_output_in_standard_format
3
+
4
+
5
+ def test_read_main(set_env):
6
+ from square_administration.configuration import config_str_module_name
7
+ from square_administration.main import (
8
+ app,
9
+ )
10
+
11
+ client = TestClient(app)
12
+ response = client.get("/")
13
+ assert response.status_code == 200
14
+ assert response.json() == get_api_output_in_standard_format(
15
+ log=config_str_module_name
16
+ )