Skip to content

Commit 9cce518

Browse files
authored
RuntimeConfig: Set default variable state to Unspecified (googleapis#4738)
1 parent 1c6fd1f commit 9cce518

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

runtimeconfig/google/cloud/runtimeconfig/variable.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ def state(self):
139139
140140
:rtype: str
141141
:returns:
142-
If set, one of "UPDATED", "DELETED", or
143-
"VARIABLE_STATE_UNSPECIFIED", else ``None``.
142+
If set, one of "UPDATED", "DELETED", or defaults to
143+
"VARIABLE_STATE_UNSPECIFIED".
144144
"""
145-
return self._properties.get('state')
145+
return self._properties.get('state', STATE_UNSPECIFIED)
146146

147147
@property
148148
def update_time(self):

runtimeconfig/tests/unit/test_variable.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,15 @@ def _verifyResourceProperties(self, variable, resource):
5656

5757
def test_ctor(self):
5858
from google.cloud.runtimeconfig.config import Config
59+
from google.cloud.runtimeconfig.variable import STATE_UNSPECIFIED
5960

6061
client = _Client(project=self.PROJECT)
6162
config = Config(name=self.CONFIG_NAME, client=client)
6263
variable = self._make_one(name=self.VARIABLE_NAME, config=config)
6364
self.assertEqual(variable.name, self.VARIABLE_NAME)
6465
self.assertEqual(variable.full_name, self.PATH)
6566
self.assertEqual(variable.path, '/%s' % (self.PATH,))
67+
self.assertEqual(variable.state, STATE_UNSPECIFIED)
6668
self.assertIs(variable.client, client)
6769

6870
def test_ctor_w_no_name(self):

0 commit comments

Comments
 (0)