コード例 #1
0
    def test_breaking2(self, client):
        new = SecretReferenceConfigurationSetting("aref", "notaurl")
        client.set_configuration_setting(new)
        new1 = client.get_configuration_setting(new.key)

        new = SecretReferenceConfigurationSetting("aref1", "notaurl")
        new.content_type = "fkaeyjfdkal;"
        client.set_configuration_setting(new)
        new1 = client.get_configuration_setting(new.key)
コード例 #2
0
    def test_config_setting_secret_reference(self, client):
        secret_reference = SecretReferenceConfigurationSetting(
            "ConnectionString",
            "https://test-test.vault.azure.net/secrets/connectionString")
        set_flag = client.set_configuration_setting(secret_reference)
        self._assert_same_keys(secret_reference, set_flag)

        set_flag.secret_uri = "https://test-test.vault.azure.net/new_secrets/connectionString"
        updated_flag = client.set_configuration_setting(set_flag)
        self._assert_same_keys(set_flag, updated_flag)

        assert isinstance(updated_flag, SecretReferenceConfigurationSetting)
        new_uri = "https://aka.ms/azsdk"
        new_uri2 = "https://aka.ms/azsdk/python"
        updated_flag.secret_uri = new_uri
        assert updated_flag.value['secret_uri'] == new_uri

        updated_flag.value = {'secret_uri': new_uri2}
        assert updated_flag.secret_uri == new_uri2

        with pytest.raises(ValueError):
            set_flag.value = "bad_value"
            _ = set_flag.secret_uri

        client.delete_configuration_setting(secret_reference.key)
コード例 #3
0
    def test_config_setting_secret_reference(self, client):
        secret_reference = SecretReferenceConfigurationSetting(
            "ConnectionString",
            "https://test-test.vault.azure.net/secrets/connectionString")
        set_flag = client.set_configuration_setting(secret_reference)
        self._assert_same_keys(secret_reference, set_flag)

        set_flag.secret_id = "https://test-test.vault.azure.net/new_secrets/connectionString"
        updated_flag = client.set_configuration_setting(set_flag)
        self._assert_same_keys(set_flag, updated_flag)

        assert isinstance(updated_flag, SecretReferenceConfigurationSetting)
        new_uri = "https://aka.ms/azsdk"
        new_uri2 = "https://aka.ms/azsdk/python"
        updated_flag.secret_id = new_uri
        temp = json.loads(updated_flag.value)
        assert temp['uri'] == new_uri

        updated_flag.value = json.dumps({'uri': new_uri2})
        assert updated_flag.secret_id == new_uri2

        set_flag.value = "bad_value"
        assert set_flag.secret_id == None

        client.delete_configuration_setting(secret_reference.key)
コード例 #4
0
 def test_type_error(self, client):
     with pytest.raises(TypeError):
         _ = FeatureFlagConfigurationSetting("blash", key="blash")
     with pytest.raises(TypeError):
         _ = FeatureFlagConfigurationSetting("blash", value="blash")
     with pytest.raises(TypeError):
         _ = SecretReferenceConfigurationSetting("blash", value="blash")