ATProto.create_for: better support for local testing

dependabot/pip/requests-oauthlib-2.0.0
Ryan Barrett 2024-03-20 14:16:39 -07:00
rodzic e5fde2deb6
commit 5a1dda151c
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
3 zmienionych plików z 9 dodań i 6 usunięć

Wyświetl plik

@ -208,9 +208,10 @@ class ATProto(User, Protocol):
return
# create new DID, repo
logger.info(f'Creating new did:plc for {user.key}')
pds_url = common.host_url() if DEBUG else cls.PDS_URL
logger.info(f'Creating new did:plc for {user.key} {pds_url}')
did_plc = did.create_plc(user.handle_as('atproto'),
pds_url=cls.PDS_URL,
pds_url=pds_url,
post_fn=util.requests_post)
Object.get_or_create(did_plc.did, raw=did_plc.doc)
@ -223,7 +224,9 @@ class ATProto(User, Protocol):
name = f'_atproto.{handle}.'
val = f'"did={did_plc.did}"'
logger.info(f'adding GCP DNS TXT record for {name} {val}')
if not DEBUG:
if DEBUG:
logger.info(' skipped since DEBUG is true')
else:
zone = dns_client.zone(DNS_ZONE)
r = zone.resource_record_set(name=name, record_type='TXT', ttl=DNS_TTL,
rrdatas=[val])

Wyświetl plik

@ -37,7 +37,7 @@ PROTOCOLS = {'ostatus': None}
# 2048 bits makes tests slow, so use 1024 for them
KEY_BITS = 1024 if DEBUG else 2048
PAGE_SIZE = 20
PAGE_SIZE = 30
# auto delete old objects of these types via the Object.expire property
# https://cloud.google.com/datastore/docs/ttl

Wyświetl plik

@ -644,7 +644,7 @@ class ATProtoTest(TestCase):
assert did
self.assertEqual([Target(uri=did, protocol='atproto')], user.copies)
did_obj = ATProto.load(did, did_doc=True)
self.assertEqual('https://atproto.brid.gy/',
self.assertEqual('http://localhost/',
did_obj.raw['service'][0]['serviceEndpoint'])
# check repo, record
@ -678,7 +678,7 @@ class ATProtoTest(TestCase):
'services': {
'atproto_pds': {
'type': 'AtprotoPersonalDataServer',
'endpoint': 'https://atproto.brid.gy/',
'endpoint': 'http://localhost/',
}
},
'prev': None,