Skip to content

Commit

Permalink
tests: add test case for cli.apikey.key_names
Browse files Browse the repository at this point in the history
  • Loading branch information
enku committed Jun 3, 2024
1 parent 96168ba commit 7a07f00
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_cli_apikey.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,20 @@ def test(self) -> None:
parser = ArgumentParser()

apikey.parse_args(parser)


class KeyNamesTests(TestCase):
def test(self) -> None:
names = ["this", "that", "the", "other"]

for name in names:
api_key = ApiKey(
name=name, key=apikey.create_api_key(), created=time.localtime()
)
publisher.repo.api_keys.save(api_key)

response = apikey.key_names(
prefix="", action=Mock(), parser=Mock(), parsed_args=Mock()
)

self.assertEqual(response, sorted(names))

0 comments on commit 7a07f00

Please sign in to comment.