Isolate PMO credential from existing differently owned credentials directory
Deploy Canina / deploy (push) Successful in 4m30s
Deploy Canina / deploy (push) Successful in 4m30s
This commit is contained in:
1 parent
7485c89e9b
commit
ba0aa5ee4e
4 files changed
+8
-6
No files matched your search
@@ -59,7 +59,7 @@ def submit(home, commit, proposal, *, endpoint=ENDPOINT, timeout=15):
|
||||
topic, criteria = proposal['researchTopic'], proposal['acceptanceCriteria']
|
||||
if not isinstance(topic, str) or not topic.strip() or len(topic) > 180 or not isinstance(criteria, list) or not 1 <= len(criteria) <= 10 or any(not isinstance(v, str) or not v.strip() or len(v) > 500 for v in criteria):
|
||||
raise ValueError('Invalid proposal')
|
||||
token = private_read(home/'credentials/editorial-pmo-token').decode('ascii')
|
||||
token = private_read(home/'editorial-v4/credentials/editorial-pmo-token').decode('ascii')
|
||||
if not re.fullmatch('[A-Za-z0-9_-]{64}', token): raise ValueError('Invalid credential')
|
||||
directory = safe(home/'editorial-v4/client-state')
|
||||
directory.mkdir(mode=0o700, parents=True, exist_ok=True)
|
||||
|
||||
@@ -32,8 +32,8 @@ class ClientTests(unittest.TestCase):
|
||||
thread = threading.Thread(target=server.serve_forever, daemon=True); thread.start()
|
||||
try:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
home = Path(tmp); (home/'credentials').mkdir(mode=0o700)
|
||||
token = home/'credentials/editorial-pmo-token'; token.write_text('x'*64); token.chmod(0o400)
|
||||
home = Path(tmp); (home/'editorial-v4/credentials').mkdir(mode=0o700, parents=True)
|
||||
token = home/'editorial-v4/credentials/editorial-pmo-token'; token.write_text('x'*64); token.chmod(0o400)
|
||||
proposal = {'researchTopic':'Owner supplied topic', 'acceptanceCriteria':['Cite dated sources']}
|
||||
endpoint = 'http://127.0.0.1:%s/api/internal/prepare-worker/editorial-proposals' % server.server_port
|
||||
a = c.submit(home, 'a'*40, proposal, endpoint=endpoint)
|
||||
|
||||
Reference in new issue
Block a user