How to use the frisby.create 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 remyla / damas-core / server-tests / tests-frisby_spec.js View on Github external
.put(url + 'lock/')
        .expectStatus(400)
    .toss();

    //Fatal error
/*    frisby.create('LOCK - should throw an error (id not found) - Not found')
        .put(url + 'lock/' + idNotFoundinDb)
        .expectStatus(404)
    .toss();
*/
    frisby.create('LOCK - should throw an error (id empty) - Not found')
        .put(url + 'lock/' + idCustom)
        .expectStatus(404)
    .toss();

    frisby.create('LOCK - should lock the asset')
        .put(url + 'lock/' + idFoundInDb)
        .expectStatus(200)
    .toss();

    frisby.create('LOCK - should lock the asset with custom id')
        .put(url + 'lock/' + idCustomEncoded)
        .expectStatus(200)
    .toss();

    frisby.create('LOCK - should throw an error (already locked)')
        .put(url + 'lock/' + idCustomEncoded)
        .expectStatus(409)
    .toss();

    /**
      * Tests for method Unlock
github remyla / damas-core / server-tests / tests-frisby_spec.js View on Github external
frisby.create('GRAPH - should get a record valid')
        .get(url + 'graph' + idFoundInDb)
        .expectStatus(200)
        .expectHeaderContains('Content-Type', tjson)
    .toss();

    frisby.create('GRAPH - should a record valid with custom id')
        .get(url + 'graph' + idCustomEncoded)
        .expectStatus(200)
        .expectHeaderContains('Content-Type', tjson)
    .toss();

    /**
      * Tests for method Lock
      */
    frisby.create('LOCK - should throw an error (id empty) - Bad request')
        .put(url + 'lock/')
        .expectStatus(400)
    .toss();

    //Fatal error
/*    frisby.create('LOCK - should throw an error (id not found) - Not found')
        .put(url + 'lock/' + idNotFoundinDb)
        .expectStatus(404)
    .toss();
*/
    frisby.create('LOCK - should throw an error (id empty) - Not found')
        .put(url + 'lock/' + idCustom)
        .expectStatus(404)
    .toss();

    frisby.create('LOCK - should lock the asset')
github niumainframe / webjcl / tests / integration / restAPISpec-old.js View on Github external
var jobListingFrisby = function (name, user, pass) {
            var endpoint = '/srcprocs/JESProc/jobs';
            
            return frisby.create(name)
                .get(host + endpoint, { auth: {user: user, pass:pass}});
        }
github joindin / joindin-api / tests / frisby / api_write_events.js View on Github external
function testEditEvent(access_token, event_uri)
{
  var today = new Date();
  var yesterday = new Date();
  yesterday.setDate(yesterday.getDate() - 1);

  frisby.create('Edit users own event')
    .put(
      event_uri,
      {
        "name" : "Frisby test approved event (edited)",
        "description" : "Test description (edited)",
        "location" : "here (edited)",
        "start_date" : yesterday.toISOString().substring(0, 10),
        "end_date" : today.toISOString().substring(0, 10),
        "tz_continent" : "Europe",
        "tz_place" : "London",
        "auto_approve_event": true
      },
      {json: true, headers: {'Authorization' : 'Bearer ' + access_token}}
    )
    .expectStatus(204)
    .expectHeaderContains("Location", event_uri)
github remyla / damas-core / server-tests / 2-3-6_spec.js View on Github external
function graph(desc, data) {
    return frisby.create('POST GRAPH - ' + desc)
        .post(url + 'graph/0/', data, {json: true});
}
github rutkai / Mjolnir-Authentication-Server / test / session_hasJoined_spec.js View on Github external
frisby.create('Missing username gives empty response')
    .get('http://localhost:' + httpPort + '/session/minecraft/hasJoined?serverId=1234')
    .expectStatus(200)
    .expectHeaderContains('content-type', 'application/json')
    .expectJSONLength(0)
    .toss();

frisby.create('Missing serverId gives empty response')
    .get('http://localhost:' + httpPort + '/session/minecraft/hasJoined?username=test')
    .expectStatus(200)
    .expectHeaderContains('content-type', 'application/json')
    .expectJSONLength(0)
    .toss();

frisby.create('Invalid serverId gives empty response')
    .get('http://localhost:' + httpPort + '/session/minecraft/hasJoined?username=test&serverId=1234')
    .expectStatus(200)
    .expectHeaderContains('content-type', 'application/json')
    .expectJSONLength(0)
    .toss();

syncTestRunner.registerTest(
    frisby.create('Authenticating for session join')
        .post('http://localhost:' + httpPort + '/authenticate', {
            "agent": {
                "name": "Minecraft",
                "version": 1
            },
            "username": "test",
            "password": "test"
        })
github rutkai / Mjolnir-Authentication-Server / test / invalidate_spec.js View on Github external
.afterJSON(function (response) {
            frisby.create('then invalidating without client token')
                .post('http://localhost:' + httpPort + '/invalidate', {
                    "accessToken": response.accessToken
                })
                .expectStatus(200)
                .expectHeaderContains('content-type', 'application/json')
                .expectJSONLength(0)
                .after(function () {
                    frisby.create('invalidates the user session')
                        .post('http://localhost:' + httpPort + '/validate', {
                            "accessToken": response.accessToken
                        })
                        .expectStatus(200)
                        .expectHeaderContains('content-type', 'application/json')
                        .expectJSON({
                            "error": "ForbiddenOperationException",
                            "errorMessage": "Invalid token"
github CityWebConsultants / Iris / tests / messages_spec.js View on Github external
exports.createMessageReply_val = function (data) {

  message_normal_base.credentials = data.userCredentials;

  var message = message_normal_base;

  message.content = "reply";
  
  message.groupid = data.groupid;

  message.replyTo = data.messageid;

  frisby.create("Create reply to message (standard)")
    .post(apiUrl + '/entity/create/message', utils.stringifyParameters(message))
    .expectStatus(200)
    .expectJSON({
      userid: function (val) {
        expect(val).toBe(message.userid);
      },
      type: function (val) {
        expect(val).toBe(message.type);
      },
      content: function (val) {
        expect(val).toBe(message.content);
      },
      groupid: function (val) {
        expect(val).toBe(message.groupid);
      },
      parents: function (val) {
github joindin / joindin-api / tests / frisby / api_write_events.js View on Github external
baseURL + "/v2.1/events",
      {
        "name" : "Frisby test event",
        "description" : "Test description",
        "location" : "here",
        "start_date" : "here"
      },
      {json: true, headers: {'Authorization' : 'Bearer ' + access_token}}
    )
    .expectStatus(400)
    .afterJSON(function(result) {
      expect(result[0]).toContain("Both 'start_date' and 'end_date' must be supplied in a recognised format");
    })
    .toss();

  frisby.create('Create event fails with invalid end_date')
    .post(
      baseURL + "/v2.1/events",
      {
        "name" : "Frisby test event",
        "description" : "Test description",
        "location" : "here",
        "start_date" : "2015-01-01",
        "end_date" : "here"
      },
      {json: true, headers: {'Authorization' : 'Bearer ' + access_token}}
    )
    .expectStatus(400)
    .afterJSON(function(result) {
      expect(result[0]).toContain("Both 'start_date' and 'end_date' must be supplied in a recognised format");
    })
    .toss();
github joindin / joindin-api / tests / frisby / api_write_events.js View on Github external
"description" : "Test description",
        "location" : "here",
        "start_date" : "2015-01-01",
        "end_date" : "2015-01-01",
        "tz_continent" : "Europe",
        "tz_place" : "There"
      },
      {json: true, headers: {'Authorization' : 'Bearer ' + access_token}}
    )
    .expectStatus(400)
    .afterJSON(function(result) {
      expect(result[0]).toContain("The fields 'tz_continent' and 'tz_place' must be supplied");
    })
    .toss();

  frisby.create('Create event fails with invalid tx_continent')
    .post(
      baseURL + "/v2.1/events",
      {
        "name" : "Frisby test event",
        "description" : "Test description",
        "location" : "here",
        "start_date" : "2015-01-01",
        "end_date" : "2015-01-01",
        "tz_continent" : "Here",
        "tz_place" : "London"
      },
      {json: true, headers: {'Authorization' : 'Bearer ' + access_token}}
    )
    .expectStatus(400)
    .afterJSON(function(result) {
      expect(result[0]).toContain("The fields 'tz_continent' and 'tz_place' must be supplied");

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