You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add e2e relationship tests for pre-GA validation (microsoft#152)
## Summary
Add end-to-end relationship tests that validate the full relationship
API lifecycle against a live Dataverse environment. This is the primary
pre-GA validation for Tim's relationship PRs (microsoft#88, microsoft#105, microsoft#114).
## Changes
### New: `tests/e2e/test_relationships_e2e.py`
11 curated e2e tests covering:
| Test Class | Tests | Coverage |
|---|---|---|
| `TestOneToManyCore` | 1 | Full 1:N lifecycle: create, get, delete,
field assertions |
| `TestLookupField` | 1 | Convenience `create_lookup_field` to system
table |
| `TestManyToMany` | 2 | N:N lifecycle + nonexistent returns None |
| `TestDataThroughRelationships` | 4 | `@odata.bind`, `$expand`,
`$filter` on lookup, update binding |
| `TestCascadeBehaviors` | 2 | Restrict blocks delete; Cascade deletes
children |
| `TestTypeDetection` | 1 | `get_relationship` distinguishes 1:N vs N:N
|
### Updated: `examples/basic/functional_testing.py`
- Added relationship testing section covering 1:N core API, convenience
API, N:N, get, and delete
- Added relationship imports and retry helpers
### Updated: `pyproject.toml`
- Added `[tool.pytest.ini_options]` with `testpaths = ["tests/unit"]`
- Default `pytest` runs only unit tests; e2e tests require explicit
invocation
## How to run e2e tests
```bash
# Set your Dataverse org URL
export DATAVERSE_URL=https://yourorg.crm.dynamics.com
# Run relationship e2e tests
pytest tests/e2e/ -v -s
```
The tests authenticate via `InteractiveBrowserCredential` and
create/delete temporary tables (prefixed `test_E2E*`).
## E2E Test Results (from `.scratch/` comprehensive suite)
Ran 30 tests against `https://aurorabapenv71aff.crm10.dynamics.com`:
- 25/30 passed on first run
- 5 failures were test bugs (not SDK bugs), all fixed:
- Metadata propagation timing (increased retries)
- Navigation property name casing (`$expand` needs server-assigned nav
prop)
- `IsValidForAdvancedFind` requires `BooleanManagedProperty` complex
type
## Finding: SDK inconsistency to address before GA
`create_one_to_many_relationship()` returns `lookup_schema_name` as the
user-provided SchemaName, but `$expand` requires the server-assigned
`ReferencingEntityNavigationPropertyName` (which may differ in casing).
The e2e tests work around this by calling `get_relationship()` after
create to get the correct nav prop name. This should be harmonized
before GA.
## Checklist
- [x] 398 unit tests pass
- [x] 11 e2e tests collected by pytest
- [x] Default `pytest` excludes e2e (runs unit only)
- [x] Code formatted with black
- [x] Branch rebased on origin/main
---------
Co-authored-by: Saurabh Badenkal <sbadenkal@microsoft.com>
0 commit comments