feat #14740: admin backend client and transcript upload text
recorder-core side of linking the app to the euvino admin backend: - backend: BackendClient (create a key with the admin's session cookie, check a key, upload a transcript; redirects never followed), German error messages, the login-window decision (LoginStep) and the upload flow with login, one retry after a refused key and no loop - call_view: the upload text (header + merged, renamed lines) and the upload fields on the call - store: schema v3 with crm_transcript_id and uploaded_at - settings: backend_url (validated https), the app-managed login fields, kept on edit and cleared when the backend URL changes - secrets: Service::Backend; http: per-request follow_redirects; FakeTransport can script transport errors Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,8 +10,7 @@ use crate::http::{HttpRequest, HttpResponse, HttpTransport, Method, TransportErr
|
||||
struct Expectation {
|
||||
method: Method,
|
||||
url: String,
|
||||
status: u16,
|
||||
body: Vec<u8>,
|
||||
response: Result<HttpResponse, TransportError>,
|
||||
}
|
||||
|
||||
/// Scripted [`HttpTransport`]: queue expected requests in order with
|
||||
@@ -36,11 +35,24 @@ impl FakeTransport {
|
||||
|
||||
/// Queues the next expected request and the response to return for it.
|
||||
pub fn expect(&self, method: Method, url: &str, status: u16, body: impl Into<Vec<u8>>) {
|
||||
let response = HttpResponse {
|
||||
status,
|
||||
body: body.into(),
|
||||
};
|
||||
self.push(method, url, Ok(response));
|
||||
}
|
||||
|
||||
/// Queues the next expected request and the transport error it fails
|
||||
/// with (e.g. the server is unreachable).
|
||||
pub fn fail(&self, method: Method, url: &str, error: TransportError) {
|
||||
self.push(method, url, Err(error));
|
||||
}
|
||||
|
||||
fn push(&self, method: Method, url: &str, response: Result<HttpResponse, TransportError>) {
|
||||
self.expectations.lock().unwrap().push(Expectation {
|
||||
method,
|
||||
url: url.to_string(),
|
||||
status,
|
||||
body: body.into(),
|
||||
response,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -92,9 +104,6 @@ impl HttpTransport for FakeTransport {
|
||||
);
|
||||
}
|
||||
self.requests.lock().unwrap().push(req);
|
||||
Ok(HttpResponse {
|
||||
status: expectation.status,
|
||||
body: expectation.body,
|
||||
})
|
||||
expectation.response
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user