Skip to content

Commit

Permalink
chore: remove unused list_registered legacy code
Browse files Browse the repository at this point in the history
This code has since been ported to the newer instances as a Craft CLI
command "names", which uses a newer implementation that does not have
any reference to price.

With this we remove the last references to Price, even if unused.

Signed-off-by: Sergio Schvezov <[email protected]>
  • Loading branch information
sergiusens committed Sep 1, 2023
1 parent 3335631 commit 7bcd1eb
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 49 deletions.
1 change: 0 additions & 1 deletion snapcraft_legacy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,6 @@ def _get_version():
download,
gated,
list_keys,
list_registered,
login,
register,
register_key,
Expand Down
29 changes: 0 additions & 29 deletions snapcraft_legacy/_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import contextlib
import json
import logging
import operator
import os
import re
import subprocess
Expand Down Expand Up @@ -369,34 +368,6 @@ def register(
super().register(snap_name=snap_name, is_private=is_private, store_id=store_id)


def list_registered():
account_info = StoreClientCLI().get_account_information()
snaps = [
(
name,
info["since"],
"private" if info["private"] else "public",
info["price"] or "-",
"-",
)
for name, info in account_info["snaps"].get(DEFAULT_SERIES, {}).items()
# Presenting only approved snap registrations, which means name
# disputes will be displayed/sorted some other way.
if info["status"] == "Approved"
]

if not snaps:
echo.warning("There are no registered snaps.")
return

tabulated_snaps = tabulate(
sorted(snaps, key=operator.itemgetter(0)),
headers=["Name", "Since", "Visibility", "Price", "Notes"],
tablefmt="plain",
)
print(tabulated_snaps)


def _get_usable_keys(name=None):
snap_path = get_host_tool_path(command_name="snap", package_name="snapd")
keys = json.loads(
Expand Down
10 changes: 0 additions & 10 deletions tests/legacy/fake_servers/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1119,63 +1119,54 @@ def account(self, request):
"snap-id": "snap-id",
"status": "Approved",
"private": False,
"price": None,
"since": "2016-12-12T01:01:01Z",
},
"test-snap-with-no-validations": {
"snap-id": "test-snap-id-with-no-validations",
"status": "Approved",
"private": False,
"price": None,
"since": "2016-12-12T01:01:01Z",
},
"test-snap-with-dev": {
"snap-id": "test-snap-id-with-dev",
"status": "Approved",
"private": False,
"price": None,
"since": "2016-12-12T01:01:01Z",
},
"core": {
"snap-id": "good",
"status": "Approved",
"private": False,
"price": None,
"since": "2016-12-12T01:01:01Z",
},
"core-no-dev": {
"snap-id": "no-dev",
"status": "Approved",
"private": False,
"price": None,
"since": "2016-12-12T01:01:01Z",
},
"badrequest": {
"snap-id": "badrequest",
"status": "Approved",
"private": False,
"price": None,
"since": "2016-12-12T01:01:01Z",
},
"revoked": {
"snap-id": "revoked",
"status": "Approved",
"private": False,
"price": None,
"since": "2016-12-12T01:01:01Z",
},
"no-revoked": {
"snap-id": "no-revoked",
"status": "Approved",
"private": False,
"price": None,
"since": "2016-12-12T01:01:01Z",
},
"no-id": {
"snap-id": None,
"status": "Approved",
"private": False,
"price": None,
"since": "2016-12-12T01:01:01Z",
},
}
Expand All @@ -1185,7 +1176,6 @@ def account(self, request):
"snap-id": snap_data["snap_id"],
"status": "Approved",
"private": snap_data["private"],
"price": None,
"since": "2016-12-12T01:01:01Z",
}
for name, snap_data in self.registered_names.items()
Expand Down
9 changes: 0 additions & 9 deletions tests/legacy/unit/store/test_store_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,53 +185,45 @@ def test_get_account_information_successfully(self):
"snap-id": "snap-id",
"status": "Approved",
"private": False,
"price": None,
"since": "2016-12-12T01:01:01Z",
},
"core": {
"snap-id": "good",
"status": "Approved",
"private": False,
"price": None,
"since": "2016-12-12T01:01:01Z",
},
"core-no-dev": {
"snap-id": "no-dev",
"status": "Approved",
"private": False,
"price": None,
"since": "2016-12-12T01:01:01Z",
},
"badrequest": {
"snap-id": "badrequest",
"status": "Approved",
"private": False,
"price": None,
"since": "2016-12-12T01:01:01Z",
},
"no-revoked": {
"snap-id": "no-revoked",
"status": "Approved",
"private": False,
"price": None,
"since": "2016-12-12T01:01:01Z",
},
"revoked": {
"snap-id": "revoked",
"status": "Approved",
"private": False,
"price": None,
"since": "2016-12-12T01:01:01Z",
},
"test-snap-with-dev": {
"price": None,
"private": False,
"since": "2016-12-12T01:01:01Z",
"snap-id": "test-snap-id-with-dev",
"status": "Approved",
},
"test-snap-with-no-validations": {
"price": None,
"private": False,
"since": "2016-12-12T01:01:01Z",
"snap-id": "test-snap-id-with-no-validations",
Expand All @@ -241,7 +233,6 @@ def test_get_account_information_successfully(self):
"snap-id": None,
"status": "Approved",
"private": False,
"price": None,
"since": "2016-12-12T01:01:01Z",
},
}
Expand Down

0 comments on commit 7bcd1eb

Please sign in to comment.