MCPcopy Create free account
hub / github.com/arun11299/cpp-jwt / TEST

Function TEST

tests/test_jwt_encode.cc:7–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include "jwt/jwt.hpp"
6
7TEST (EncodeTest, TestRemoveClaim)
8{
9 using namespace jwt::params;
10
11 jwt::jwt_object obj{algorithm("HS256"), secret("secret")};
12
13 obj.add_claim("iss", "arun.muralidharan")
14 .add_claim("sub", "admin")
15 .add_claim("id", "a-b-c-d-e-f-1-2-3")
16 .add_claim("iat", 1513862371)
17 .add_claim("exp", std::chrono::system_clock::now());
18
19 EXPECT_TRUE (obj.has_claim(jwt::registered_claims::expiration));
20
21 obj.remove_claim("exp");
22 EXPECT_FALSE (obj.has_claim(jwt::registered_claims::expiration));
23
24 obj.remove_claim(jwt::registered_claims::subject);
25 EXPECT_FALSE (obj.has_claim("sub"));
26}
27
28TEST (EncodeTest, TestRemoveTypHeader)
29{

Callers

nothing calls this directly

Calls 15

secretFunction · 0.85
payloadFunction · 0.85
headersFunction · 0.85
algorithmsFunction · 0.85
verifyFunction · 0.85
add_claimMethod · 0.80
remove_claimMethod · 0.80
has_headerMethod · 0.80
headerMethod · 0.80
remove_headerMethod · 0.80
payloadMethod · 0.80
algoMethod · 0.80

Tested by

no test coverage detected