Skip to content

Commit

Permalink
fixup! Add raw endpoint.
Browse files Browse the repository at this point in the history
Correctly test the raw endpoint.
  • Loading branch information
mgautierfr committed Dec 23, 2021
1 parent 391c61b commit 27ef76b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,18 @@ TEST_F(ServerTest, RawEntry)
EXPECT_EQ(200, p->status);
EXPECT_EQ(p->body, std::string("Wikipedia"));

// The raw content of Ray_Charles doesn't contain a taskbar...
// The raw content of Ray_Charles returned by the server is
// the same than the one in the zim file.
auto archive = zim::Archive("./test/zimfile.zim");
auto entry = archive.getEntryByPath("A/Ray_Charles");
p = zfs1_->GET("/raw/zimfile/content/A/Ray_Charles");
EXPECT_EQ(200, p->status);
EXPECT_TRUE(p->body.find("taskbar") == std::string::npos);
EXPECT_EQ(std::string(p->body), std::string(entry.getItem(true).getData()));

// ... but the "normal" content does.
// ... but the "normal" content is not
p = zfs1_->GET("/zimfile/A/Ray_Charles");
EXPECT_EQ(200, p->status);
EXPECT_NE(std::string(p->body), std::string(entry.getItem(true).getData()));
EXPECT_TRUE(p->body.find("taskbar") != std::string::npos);
}

Expand Down

0 comments on commit 27ef76b

Please sign in to comment.