pum 1.1.15__tar.gz → 1.1.18__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.
- {pum-1.1.15 → pum-1.1.18}/PKG-INFO +1 -1
- {pum-1.1.15 → pum-1.1.18}/pum/role_manager.py +11 -6
- {pum-1.1.15 → pum-1.1.18}/pum.egg-info/PKG-INFO +1 -1
- {pum-1.1.15 → pum-1.1.18}/pyproject.toml +1 -1
- {pum-1.1.15 → pum-1.1.18}/test/test_config.py +5 -0
- {pum-1.1.15 → pum-1.1.18}/test/test_roles.py +14 -0
- {pum-1.1.15 → pum-1.1.18}/LICENSE +0 -0
- {pum-1.1.15 → pum-1.1.18}/README.md +0 -0
- {pum-1.1.15 → pum-1.1.18}/pum/__init__.py +0 -0
- {pum-1.1.15 → pum-1.1.18}/pum/changelog.py +0 -0
- {pum-1.1.15 → pum-1.1.18}/pum/checker.py +0 -0
- {pum-1.1.15 → pum-1.1.18}/pum/cli.py +0 -0
- {pum-1.1.15 → pum-1.1.18}/pum/config_model.py +0 -0
- {pum-1.1.15 → pum-1.1.18}/pum/dependency_handler.py +0 -0
- {pum-1.1.15 → pum-1.1.18}/pum/dumper.py +0 -0
- {pum-1.1.15 → pum-1.1.18}/pum/exceptions.py +0 -0
- {pum-1.1.15 → pum-1.1.18}/pum/hook.py +0 -0
- {pum-1.1.15 → pum-1.1.18}/pum/info.py +0 -0
- {pum-1.1.15 → pum-1.1.18}/pum/parameter.py +0 -0
- {pum-1.1.15 → pum-1.1.18}/pum/pum_config.py +0 -0
- {pum-1.1.15 → pum-1.1.18}/pum/schema_migrations.py +0 -0
- {pum-1.1.15 → pum-1.1.18}/pum/sql_content.py +0 -0
- {pum-1.1.15 → pum-1.1.18}/pum/upgrader.py +0 -0
- {pum-1.1.15 → pum-1.1.18}/pum.egg-info/SOURCES.txt +0 -0
- {pum-1.1.15 → pum-1.1.18}/pum.egg-info/dependency_links.txt +0 -0
- {pum-1.1.15 → pum-1.1.18}/pum.egg-info/entry_points.txt +0 -0
- {pum-1.1.15 → pum-1.1.18}/pum.egg-info/requires.txt +0 -0
- {pum-1.1.15 → pum-1.1.18}/pum.egg-info/top_level.txt +0 -0
- {pum-1.1.15 → pum-1.1.18}/requirements/base.txt +0 -0
- {pum-1.1.15 → pum-1.1.18}/requirements/development.txt +0 -0
- {pum-1.1.15 → pum-1.1.18}/setup.cfg +0 -0
- {pum-1.1.15 → pum-1.1.18}/test/test_changelog.py +0 -0
- {pum-1.1.15 → pum-1.1.18}/test/test_dumper.py +0 -0
- {pum-1.1.15 → pum-1.1.18}/test/test_schema_migrations.py +0 -0
- {pum-1.1.15 → pum-1.1.18}/test/test_upgrader.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pum
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.18
|
|
4
4
|
Summary: Pum stands for "Postgres Upgrades Manager". It is a Database migration management tool very similar to flyway-db or Liquibase, based on metadata tables.
|
|
5
5
|
Author-email: Denis Rouzaud <denis@opengis.ch>
|
|
6
6
|
License-Expression: GPL-2.0-or-later
|
|
@@ -125,7 +125,7 @@ class Role:
|
|
|
125
125
|
self.inherit = inherit
|
|
126
126
|
self.description = description
|
|
127
127
|
|
|
128
|
-
def permissions(self):
|
|
128
|
+
def permissions(self) -> list[Permission]:
|
|
129
129
|
"""
|
|
130
130
|
Returns the list of permissions associated with the role.
|
|
131
131
|
"""
|
|
@@ -138,11 +138,16 @@ class Role:
|
|
|
138
138
|
Returns:
|
|
139
139
|
bool: True if the role exists, False otherwise.
|
|
140
140
|
"""
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
141
|
+
return (
|
|
142
|
+
SqlContent("SELECT 1 FROM pg_roles WHERE rolname = {name}")
|
|
143
|
+
.execute(
|
|
144
|
+
connection=connection,
|
|
145
|
+
commit=False,
|
|
146
|
+
parameters={"name": psycopg.sql.Literal(self.name)},
|
|
147
|
+
)
|
|
148
|
+
.fetchone()
|
|
149
|
+
is not None
|
|
150
|
+
)
|
|
146
151
|
|
|
147
152
|
def create(
|
|
148
153
|
self, connection: psycopg.Connection, grant: bool = False, commit: bool = False
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pum
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.18
|
|
4
4
|
Summary: Pum stands for "Postgres Upgrades Manager". It is a Database migration management tool very similar to flyway-db or Liquibase, based on metadata tables.
|
|
5
5
|
Author-email: Denis Rouzaud <denis@opengis.ch>
|
|
6
6
|
License-Expression: GPL-2.0-or-later
|
|
@@ -6,6 +6,8 @@ from packaging.version import parse as parse_version
|
|
|
6
6
|
from pum.pum_config import PumConfig
|
|
7
7
|
from pum.exceptions import PumConfigError
|
|
8
8
|
from pum.hook import HookHandler
|
|
9
|
+
import os
|
|
10
|
+
import platform
|
|
9
11
|
|
|
10
12
|
|
|
11
13
|
class TestConfig(unittest.TestCase):
|
|
@@ -98,6 +100,9 @@ class TestConfig(unittest.TestCase):
|
|
|
98
100
|
PumConfig(base_path=Path("test") / "data" / "parameters", validate=True)
|
|
99
101
|
|
|
100
102
|
def test_minimum_version(self) -> None:
|
|
103
|
+
if os.environ.get("CI") and platform.system().lower().startswith("win"):
|
|
104
|
+
self.skipTest("Skipped on Windows in CI")
|
|
105
|
+
|
|
101
106
|
with self.assertRaises(PumConfigError):
|
|
102
107
|
PumConfig(
|
|
103
108
|
base_path=Path("test") / "data" / "single_changelog",
|
|
@@ -98,6 +98,20 @@ class TestRoles(unittest.TestCase):
|
|
|
98
98
|
)
|
|
99
99
|
self.assertTrue(cur.fetchone()[0])
|
|
100
100
|
|
|
101
|
+
def test_multiple_installs_roles(self) -> None:
|
|
102
|
+
"""Test granting permissions to roles."""
|
|
103
|
+
test_dir = Path("test") / "data" / "roles"
|
|
104
|
+
cfg = PumConfig.from_yaml(test_dir / ".pum.yaml")
|
|
105
|
+
with psycopg.connect(f"service={self.pg_service}") as conn:
|
|
106
|
+
Upgrader(cfg).install(connection=conn, roles=True, grant=True, commit=True)
|
|
107
|
+
cur = conn.cursor()
|
|
108
|
+
cur.execute(
|
|
109
|
+
"DROP TABLE public.pum_migrations CASCADE; "
|
|
110
|
+
"DROP SCHEMA pum_test_data_schema_1 CASCADE; "
|
|
111
|
+
"DROP SCHEMA pum_test_data_schema_2 CASCADE;"
|
|
112
|
+
)
|
|
113
|
+
Upgrader(cfg).install(connection=conn, roles=True, grant=True, commit=True)
|
|
114
|
+
|
|
101
115
|
|
|
102
116
|
if __name__ == "__main__":
|
|
103
117
|
unittest.main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|