< Summary - Backend C Tests - Coverage Report (WSL)

Information
Class: auth_handler_c
Assembly: src.backend.api.handlers
File(s): ./src/backend/api/handlers/auth_handler.c
Line coverage
100%
Covered lines: 19
Uncovered lines: 0
Coverable lines: 19
Total lines: 28
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 2/18/2026 - 10:50:55 PM Line coverage: 100% (19/19) Total lines: 28

File(s)

./src/backend/api/handlers/auth_handler.c

#LineLine coverage
 1#include "auth_handler.h"
 2#include "../../database/cJSON.h"
 3#include "../../security/jwt.h"
 4#include <string.h>
 5#include <stdlib.h>
 6#include <stdio.h>
 7
 18void handle_auth_request(HttpRequest *req, HttpResponse *res) {
 9  // Mock kullanıcı bilgileri
 110  int user_id = 1;
 111  const char *username = "admin";
 112  const char *role = "admin";
 13  // jwt.h'daki orijinal generate_auth_token fonksiyonunu çağır
 114  char *token = generate_auth_token(user_id, username, role);
 115  cJSON *root = cJSON_CreateObject();
 116  cJSON_AddStringToObject(root, "status", "authenticated");
 117  cJSON_AddStringToObject(root, "token", token);
 118  cJSON_AddStringToObject(root, "role", role);
 119  cJSON_AddStringToObject(root, "username", username);
 120  char *json = cJSON_Print(root);
 121  cJSON_Delete(root);
 122  free(token);
 123  res->status_code = 200;
 124  strcpy(res->content_type, "application/json");
 125  strncpy(res->body, json, 8191);
 126  res->body[8191] = '\0';
 127  free(json);
 128}

Methods/Properties