Skip to content

Commit 8a46376

Browse files
committed
Auth.write() -> Auth.store() to match CLI command
1 parent 4d13beb commit 8a46376

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

planet/auth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ def value(self):
134134
def to_dict(self) -> dict:
135135
pass
136136

137-
def write(self,
137+
def store(self,
138138
filename: Optional[typing.Union[str, pathlib.Path]] = None):
139-
'''Write authentication information.
139+
'''Store authentication information in secret file.
140140
141141
Parameters:
142142
filename: Alternate path for the planet secret file.

planet/cli/auth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def init(ctx, email, password):
5050
'''Obtain and store authentication information'''
5151
base_url = ctx.obj['BASE_URL']
5252
plauth = planet.Auth.from_login(email, password, base_url=base_url)
53-
plauth.write()
53+
plauth.store()
5454
click.echo('Initialized')
5555
if os.getenv(ENV_API_KEY):
5656
click.echo(f'Warning - Environment variable {ENV_API_KEY} already '
@@ -72,7 +72,7 @@ def store(key):
7272
'''Store authentication information'''
7373
plauth = planet.Auth.from_key(key)
7474
if click.confirm('This overrides the stored value. Continue?'):
75-
plauth.write()
75+
plauth.store()
7676
click.echo('Updated')
7777
if os.getenv(ENV_API_KEY):
7878
click.echo(f'Warning - Environment variable {ENV_API_KEY} already '

tests/unit/test_auth.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,23 +118,23 @@ def login(*args, **kwargs):
118118
assert test_auth.value == auth_data
119119

120120

121-
def test_Auth_write_doesnotexist(tmp_path):
121+
def test_Auth_store_doesnotexist(tmp_path):
122122
test_auth = auth.Auth.from_key('test')
123123
secret_path = str(tmp_path / '.test')
124-
test_auth.write(secret_path)
124+
test_auth.store(secret_path)
125125

126126
with open(secret_path, 'r') as fp:
127127
assert json.loads(fp.read()) == {"key": "test"}
128128

129129

130-
def test_Auth_write_exists(tmp_path):
130+
def test_Auth_store_exists(tmp_path):
131131
secret_path = str(tmp_path / '.test')
132132

133133
with open(secret_path, 'w') as fp:
134134
fp.write('{"existing": "exists"}')
135135

136136
test_auth = auth.Auth.from_key('test')
137-
test_auth.write(secret_path)
137+
test_auth.store(secret_path)
138138

139139
with open(secret_path, 'r') as fp:
140140
assert json.loads(fp.read()) == {"key": "test", "existing": "exists"}

0 commit comments

Comments
 (0)