Skip to content

Commit 4f4340a

Browse files
test: update test to expect AccessError at declaration time
The test previously expected silent failure at declaration followed by error at insert time. Now we fail fast at declaration time (better UX). Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent a5ffa1f commit 4f4340a

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

tests/integration/test_privileges.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,19 @@ def test_insert_failure(self, connection_djview, schema_any):
9090
UnprivilegedLanguage().insert1(("Socrates", "Greek"))
9191

9292
def test_failure_to_create_table(self, connection_djview, schema_any):
93+
"""Table declaration should raise AccessError when user lacks CREATE privilege."""
9394
unprivileged = dj.Schema(schema_any.database, namespace, connection=connection_djview)
9495

95-
@unprivileged
96-
class Try(dj.Manual):
97-
definition = """ # should not matter really
98-
id : int
99-
---
100-
value : float
101-
"""
96+
# Should raise AccessError at declaration time, not silently fail
97+
with pytest.raises(dj.errors.AccessError):
10298

103-
with pytest.raises(dj.DataJointError):
104-
Try().insert1((1, 1.5))
99+
@unprivileged
100+
class Try(dj.Manual):
101+
definition = """ # should not matter really
102+
id : int
103+
---
104+
value : float
105+
"""
105106

106107

107108
class TestSubset:

0 commit comments

Comments
 (0)