Clone feature states, feature value and feature segments on env clone - #242
Conversation
This commit creates a global conftest that can be used by tests who exists outside the integration directory.
This reverts commit 79a5ce4.
matthewelwell
left a comment
There was a problem hiding this comment.
Looks like we're missing quite a few tests now for each of the new clone methods. I thikn it might also be wise to put in a new full integration test similar to the ones that exist at the moment in tests/integration/.
I was planning to add tests to the |
|
The integration tests aren't really testing the models, they should be testing the API interface only. So, for example, all the fixtures are created by hitting the relevant API endpoints, not by using the Django ORM. There is definitely some duplication / overlap but I quite like testing the more complicated flows with integration tests so that we can verify that the actual client experience is correct. |
matthewelwell
left a comment
There was a problem hiding this comment.
A few questions / comments.
| # Firstly, create an environment and update it's feature state | ||
|
|
||
| # Fetch the feature state id to update | ||
| feature_state = FeatureState.objects.get( |
There was a problem hiding this comment.
Can we do this without using the ORM?
| ) | ||
|
|
||
|
|
||
| def test_clone_environment_creates_permission_with_the_current_user( |
There was a problem hiding this comment.
Can we just bundle this into the test above and use the /environments/{api_key}/my-permissions/ endpoint to check the permissions?
There was a problem hiding this comment.
I think we should keep this in it's own function, since the above test is only responsible for making sure that we clone the feature states correctly(as the name suggests). wdyt?
| ) | ||
|
|
||
|
|
||
| def test_clone_environment_returns_200( |
There was a problem hiding this comment.
Do we need this test at all? We're already checking the response is 200 in the next test, right?
| assert json_response["results"][0]["id"] != feature_segment | ||
|
|
||
|
|
||
| def test_clone_clones_segments_overrides( |
There was a problem hiding this comment.
| def test_clone_clones_segments_overrides( | |
| def test_env_clone_clones_segments_overrides( |
| ) | ||
|
|
||
| # Then fetch the feature state of clone environment for the feature segement | ||
| clone_feature_segment_id = FeatureSegment.objects.get( |
There was a problem hiding this comment.
Again, can we do this without using the ORM?
matthewelwell
left a comment
There was a problem hiding this comment.
Approved with a couple of very minor points.
closes #172