How to use the frisby.get function in frisby

To help you get started, we’ve selected a few frisby examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tkeffer / weert-js / spec / server / packet_spec.js View on Github external
it("should retrieve all packets in default order", function (doneFn) {
        frisby.get(packets_url)
              .expect('status', 200)
              .then(function (res) {
                  // Could not get the Frisby test for JSON to work, so use this:
                  expect(JSON.parse(res.body)).toEqual(packets);
              })
              .done(doneFn);
    });
github redhataccess / spandx / spec / spandx / spandxSpec.js View on Github external
host: {
                            dev: "http://localhost:4014",
                            prod: "http://localhost:4015"
                        }
                    }
                }
            });

            const reqs = [
                frisby
                    .get("http://localhost:1337/")
                    .expect("status", 200)
                    .expect("header", "x-spandx-env", "dev")
                    .expect("header", "x-spandx-origin", "localhost")
                    .expect("bodyContains", /DEV/),
                frisby
                    .get("http://127.0.0.1:1337/")
                    .expect("status", 200)
                    .expect("header", "x-spandx-env", "prod")
                    .expect("header", "x-spandx-origin", "127.0.0.1")
                    .expect("bodyContains", /PROD/)
            ];

            // wait for all request promises to resolve, then close up shop
            await Promise.all(reqs.map(r => r._fetch));
            let runningServers = reqs.length;
            devServer.close(() => --runningServers == 0 && done());
            prodServer.close(() => --runningServers == 0 && done());
        });
github bkimminich / juice-shop / test / api / angularDistSpec.js View on Github external
it('GET main-es2015.js contains password hint for support team', () => {
    return frisby.get(URL + '/main-es2015.js')
      .expect('status', 200)
      .expect('bodyContains', '@echipa de suport: Secretul nostru comun este \\xeenc\\u0103 Caoimhe cu parola de master gol!')
  })
})
github bkimminich / juice-shop / test / api / fileServingSpec.js View on Github external
it('GET a restricted file directly from file system path on server via URL-encoded Directory Traversal attack loads index.html instead', () => {
    return frisby.get(URL + '/public/images/%2e%2e%2f%2e%2e%2fftp/eastere.gg')
      .expect('status', 200)
      .expect('bodyContains', '')
  })
github bkimminich / juice-shop / test / api / internetResourcesSpec.js View on Github external
it('for All Day DevOps configuration (https://pastebin.com/RXrihEMS)', () => {
      return frisby.get('https://pastebin.com/RXrihEMS')
        .expect('status', 200)
        .expect('bodyContains', 'The infamous 301 and 303 lasers.')
        .expect('bodyContains', 'Cheap Chinese crap with no quality control')
        .expect('bodyContains', 'permanent damage before you can blink your eye')
    })
  })
github bkimminich / juice-shop / test / api / searchApiSpec.js View on Github external
it('GET product search SQL Injection fails from one missing closing parenthesis', () => {
    return frisby.get(REST_URL + '/products/search?q=\') union select null,id,email,password,null,null,null from users--')
      .expect('status', 500)
      .expect('header', 'content-type', /text\/html/)
      .expect('bodyContains', '<h1>' + config.get('application.name') + ' (Express')
      .expect('bodyContains', 'SQLITE_ERROR: near "union": syntax error')
  })
</h1>
github bkimminich / juice-shop / test / api / deluxeApiSpec.js View on Github external
.then(({ json: jsonLogin }) => {
        return frisby.get(REST_URL + '/deluxe-status', {
          headers: { Authorization: 'Bearer ' + jsonLogin.authentication.token, 'content-type': 'application/json' }
        })
          .expect('status', 200)
          .expect('json', 'data', { membershipCost: 49 })
      })
  })
github bkimminich / juice-shop / test / api / erasureRequestApiSpec.js View on Github external
.then(({ json: jsonLogin }) => {
        return frisby.get(REST_URL + '/user/erasure-request', {
          headers: { 'Authorization': 'Bearer ' + jsonLogin.authentication.token }
        })
          .expect('status', 202)
          .then(() => {
            return frisby.post(REST_URL + '/user/login', {
              headers: jsonHeader,
              body: {
                email: 'bjoern.kimminich@googlemail.com',
                password: 'bW9jLmxpYW1lbGdvb2dAaGNpbmltbWlrLm5yZW9qYg=='
              }
            })
              .expect('status', 200)
          })
      })
  })
github redhataccess / spandx / spec / spandx / spandxSpec.js View on Github external
it("should resolve root dir without trailing slash", async done => {
                const { server, port } = await serve(
                    "spec/helpers/configs/root-and-subdir/",
                    4014
                );
                await spandx.init(
                    "../spec/helpers/configs/root-and-subdir/spandx.remote.js"
                );
                frisby
                    .get("http://localhost:1337")
                    .expect("status", 200)
                    .expect("bodyContains", /INDEX IN ROOT DIR/)
                    .done(() => {
                        server.close(done);
                    });
            });
            it("should resolve root dir with trailing slash", async done => {
github tkeffer / weert-js / spec / server / packet_spec.js View on Github external
.then(function () {
                  frisby.get(measurement_url)
                        .expect('status', 404);
              })
              .done(doneFn);

frisby

Frisby.js v2.0: REST API Endpoint Testing built on Jasmine

BSD-3-Clause
Latest version published 4 years ago

Package Health Score

53 / 100
Full package analysis