Exemplo n.º 1
0
    def test_should_update_value_of_feature_state(self):
        # Given
        client = self.set_up()
        feature = Feature(name="feature", project=self.project)
        feature.save()
        environment = Environment.objects.create(name="test env",
                                                 project=self.project)
        feature_state = FeatureState.objects.get(feature=feature,
                                                 environment=environment)

        # When
        response = client.put(
            "/api/v1/environments/%s/featurestates/%d/" %
            (environment.api_key, feature_state.id),
            data=self.fs_put_template %
            (feature_state.id, True, "This is a value"),
            content_type='application/json')  # should change enabled to True

        # Then
        self.assertEquals(response.status_code, status.HTTP_200_OK)
        feature_state.refresh_from_db()
        self.assertEquals(feature_state.get_feature_state_value(),
                          "This is a value")
        self.assertEquals(feature_state.enabled, True)

        Helper.clean_up()
Exemplo n.º 2
0
 def tearDown(self) -> None:
     Helper.clean_up()