This repository was archived by the owner on Jun 8, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 103
feat: foreign key on delete cascade action testing and samples #910
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7b7cca9
feat: fkdca
asthamohta 069056a
lint
asthamohta bab2faa
lint
asthamohta 1b4dd42
Merge branch 'main' into fkdc
asthamohta 51e21e9
Update samples/samples/snippets.py
asthamohta b4b7e6e
Update samples/samples/snippets.py
asthamohta e33e7d9
Merge branch 'main' into fkdc
asthamohta c06d3b6
Merge branch 'main' into fkdc
asthamohta 31d63c3
changed
asthamohta f1c2e3c
changes
asthamohta 9487290
Merge branch 'main' into fkdc
asthamohta 3b590e4
Merge branch 'main' into fkdc
asthamohta a7bbcc5
changes
asthamohta ce31137
Merge branch 'fkdc' of github.com:asthamohta/python-spanner into fkdc
asthamohta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -794,3 +794,25 @@ def test_list_database_roles(capsys, instance_id, sample_database): | |
| snippets.list_database_roles(instance_id, sample_database.database_id) | ||
| out, _ = capsys.readouterr() | ||
| assert "new_parent" in out | ||
|
|
||
|
|
||
| @pytest.mark.dependency(name="create_table_with_foreign_key_delete_cascade") | ||
| def test_create_table_with_foreign_key_delete_cascade(capsys, instance_id, sample_database): | ||
| snippets.create_table_with_foreign_key_delete_cascade(instance_id, sample_database.database_id) | ||
| out, _ = capsys.readouterr() | ||
| assert "Created Customers and ShoppingCarts table with FKShoppingCartsCustomerId" in out | ||
|
|
||
|
|
||
| @pytest.mark.dependency(name="alter_table_with_foreign_key_delete_cascade", | ||
| depends=["create_table_with_foreign_key_delete_cascade"]) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, As we are adding
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is common in samples to have this dependency to reduce the time to run these |
||
| def test_alter_table_with_foreign_key_delete_cascade(capsys, instance_id, sample_database): | ||
| snippets.alter_table_with_foreign_key_delete_cascade(instance_id, sample_database.database_id) | ||
| out, _ = capsys.readouterr() | ||
| assert "Altered ShoppingCarts table with FKShoppingCartsCustomerName" in out | ||
|
|
||
|
|
||
| @pytest.mark.dependency(depends=["alter_table_with_foreign_key_delete_cascade"]) | ||
| def test_drop_foreign_key_contraint_delete_cascade(capsys, instance_id, sample_database): | ||
| snippets.drop_foreign_key_constraint_delete_cascade(instance_id, sample_database.database_id) | ||
| out, _ = capsys.readouterr() | ||
| assert "Altered ShoppingCarts table to drop FKShoppingCartsCustomerName" in out | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be instead of checking the output message we should verify that the table was actually created/ altered by the sample or not ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For IT, yes but for samples we just need the to check if an error is not thrown