Skip to content

Commit

Permalink
Merge pull request #61 from prince-chrismc/master
Browse files Browse the repository at this point in the history
Adding SetObject to ClaimTests
  • Loading branch information
Thalhammer authored May 2, 2020
2 parents 6b349fd + f62fe8b commit 34bb064
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/ClaimTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ TEST(ClaimTest, SetArray) {
ASSERT_EQ(token, "eyJhbGciOiJub25lIn0.eyJ0ZXN0IjpbMTAwLDIwLDEwXX0.");
}

TEST(ClaimTest, SetObject) {
std::istringstream iss{"{\"api-x\": [1]}"};
jwt::claim object;
iss >> object;
ASSERT_EQ(object.get_type() , jwt::claim::type::object);

auto token = jwt::create()
.set_payload_claim("namespace", object)
.sign(jwt::algorithm::hs256("test"));
ASSERT_EQ(token, "eyJhbGciOiJIUzI1NiJ9.eyJuYW1lc3BhY2UiOnsiYXBpLXgiOlsxXX19.F8I6I2RcSF98bKa0IpIz09fRZtHr1CWnWKx2za-tFQA");
}

TEST(ClaimTest, SetAlgorithm) {
auto token = jwt::create()
.set_algorithm("test")
Expand Down

0 comments on commit 34bb064

Please sign in to comment.