upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tests/unit/stubs/esp_http_client.h
diff options
context:
space:
mode:
authorYour Name <you@example.com>2026-05-17 01:39:03 +0530
committerYour Name <you@example.com>2026-05-17 01:39:03 +0530
commit32844ac7c4a135659714aabf7d2414f156176d72 (patch)
tree414e6272a9a174bd50566c65e432ed62b29236b3 /tests/unit/stubs/esp_http_client.h
parent60e0a1042e5c56fe7d4b46d760441391df4ff809 (diff)
test_cashu (10/10) + test_session (18/18): all 86 unit tests passing
- Expand esp_http_client.h stub: full config struct + method enum + init/perform/cleanup - Add portTICK_PERIOD_MS + esp_err_to_name to stubs - session.c: reject duplicate spent secrets in session_create (double-spend protection) - .gitignore: add test binaries
Diffstat (limited to 'tests/unit/stubs/esp_http_client.h')
-rw-r--r--tests/unit/stubs/esp_http_client.h43
1 files changed, 42 insertions, 1 deletions
diff --git a/tests/unit/stubs/esp_http_client.h b/tests/unit/stubs/esp_http_client.h
index 4169714..288ce3b 100644
--- a/tests/unit/stubs/esp_http_client.h
+++ b/tests/unit/stubs/esp_http_client.h
@@ -2,11 +2,52 @@
2#define STUBS_ESP_HTTP_CLIENT_H 2#define STUBS_ESP_HTTP_CLIENT_H
3 3
4#include "esp_err.h" 4#include "esp_err.h"
5#include <string.h>
6#include <stdlib.h>
5 7
6typedef void *esp_http_client_handle_t; 8typedef enum {
9 HTTP_METHOD_GET = 0,
10 HTTP_METHOD_POST,
11 HTTP_METHOD_PUT,
12 HTTP_METHOD_DELETE,
13} esp_http_client_method_t;
14
15typedef void *esp_crt_bundle_attach_fn_t(void *conf);
7 16
8typedef struct { 17typedef struct {
18 const char *url;
19 esp_http_client_method_t method;
20 int timeout_ms;
21 esp_crt_bundle_attach_fn_t *crt_bundle_attach;
9 int cert_pem; 22 int cert_pem;
10} esp_http_client_config_t; 23} esp_http_client_config_t;
11 24
25typedef void *esp_http_client_handle_t;
26
27static inline esp_http_client_handle_t esp_http_client_init(const esp_http_client_config_t *cfg) {
28 (void)cfg;
29 return (void *)malloc(1);
30}
31static inline esp_err_t esp_http_client_set_header(esp_http_client_handle_t c, const char *k, const char *v) {
32 (void)c; (void)k; (void)v; return ESP_OK;
33}
34static inline esp_err_t esp_http_client_open(esp_http_client_handle_t c, int len) {
35 (void)c; (void)len; return ESP_OK;
36}
37static inline int esp_http_client_write(esp_http_client_handle_t c, const char *buf, int len) {
38 (void)c; (void)buf; return len;
39}
40static inline int esp_http_client_fetch_headers(esp_http_client_handle_t c) {
41 (void)c; return 0;
42}
43static inline int esp_http_client_get_status_code(esp_http_client_handle_t c) {
44 (void)c; return 200;
45}
46static inline int esp_http_client_read(esp_http_client_handle_t c, char *buf, int len) {
47 (void)c; (void)buf; (void)len; return 0;
48}
49static inline esp_err_t esp_http_client_cleanup(esp_http_client_handle_t c) {
50 free(c); return ESP_OK;
51}
52
12#endif 53#endif