bluesky: app.bsky.graph.getFollowers, handle no user

pull/371/head
Ryan Barrett 2023-01-15 10:07:04 -08:00
rodzic c1148ee3de
commit 2b2dfafc18
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
2 zmienionych plików z 5 dodań i 1 usunięć

Wyświetl plik

@ -45,6 +45,10 @@ OTHER_FOLLOW_AS2['actor'].update({
@patch('requests.get')
class XrpcGraphTest(testutil.TestCase):
def test_getProfile_no_user(self, _):
resp = self.client.get('/xrpc/app.bsky.graph.getFollowers')
self.assertEqual(400, resp.status_code)
def test_getFollowers_not_domain(self, mock_get):
resp = self.client.get('/xrpc/app.bsky.graph.getFollowers',
query_string={'user': 'not a domain'})

Wyświetl plik

@ -22,7 +22,7 @@ def get_followers(query_prop, output_field, user=None, limit=50, before=None):
dict, XRPC method output
"""
# TODO: what is user?
if not re.match(util.DOMAIN_RE, user):
if not user or not re.match(util.DOMAIN_RE, user):
raise ValueError(f'{user} is not a domain')
followers = []