it("Should download publicly an attachment from it's id", async () => { let post = await createPost(); let { body } = await request(TestServer) .post(`/rest/posts/${post._id}/attachments`) .attach('myfile', testFile('sample_image.png')) .expect(200); expect(body._attachments[0].id).to.exist; expect(body._attachments[0].id).not.to.be.null; config.testing.disableAuthentication = false; let { headers } = await request(TestServer) .get(`/rest/posts/${post._id}/attachments/${body._attachments[0].id}`) .expect(200); expect(headers['content-type']).to.equal('image/png'); expect(_.toFinite(headers['content-length'])).to.be.above(70000); })