| 5 | #include "jwt/jwt.hpp" |
| 6 | |
| 7 | TEST (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 | |
| 28 | TEST (EncodeTest, TestRemoveTypHeader) |
| 29 | { |
nothing calls this directly
no test coverage detected