How to use the supertest.post function in supertest

To help you get started, we’ve selected a few supertest 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 HenryGau / node-paypal-ipn / tests / subscriptionMessage.js View on Github external
it('POST will send a new IPN message to IPN listener', function(done){
		console.log('New subscription from user:', requestForm.payer_email);

		request.post('/')
			// format application/x-www-form-urlencoded
			.type('form')
			.send(requestForm)
			.expect(function(res){
				console.log('POST response body:' + JSON.stringify(res.body));
			})
			.expect(200, done);
	});
github peterjoseph / Reeve / tests_integration / 01_authentication.js View on Github external
test("Owner Account Login - Valid Body - 200 Response", async t => {
	const response = await request.post("api/v1.0/authentication/login").send({
		workspaceURL: testData.workspaceURL,
		emailAddress: testData.emailAddress,
		password: testData.password,
		keepSignedIn: false
	});
	t.is(response.status, 200);
	t.not(response.body.token, null);
	t.is(response.body.keepSignedIn, false);

	// Store token for future user
	testData.securityToken = `jwt ${response.body.token}`;
});
github peterjoseph / Reeve / tests_integration / 01_authentication.js View on Github external
test("Owner Account Invalid Security Token Login Failure - Invalid Token - 403 Response", async t => {
	const response = await request
		.post("api/v1.0/authentication/login")
		.set("Authorization", "invalid security token")
		.send({
			authToken: true
		});
	t.is(response.status, 403);
});
github Inist-CNRS / ezmaster / test / testFakeapp.js View on Github external
it('Create fakeapp', function (done) {

    var data = {
      'longName' : 'fakeapp',
      'project' : 'test',
      'version' : '',
      'study': 'fakeapp',
      'technicalName' :  'test-fakeapp',
      'app' : 'fakeapp'
    };

    request
    .post('/-/v1/instances')
    .send(data)
    .expect(200, function (err) {
      done(err);
    });



  });
github Inist-CNRS / ezmaster / test / testImage.js View on Github external
it('Create image', function (done) {

    var data = {
      'imageName' : 'hello-world',
      'versionImage' : 'latest',
      'imageHub' : ''
    };

    request
    .post('/-/v1/app')
    .send(data)
    .expect(200, function (err) {
      done(err);
    });



  });
github peterjoseph / Reeve / tests_integration / 01_authentication.js View on Github external
test("Owner Account Logout - Valid Header - 200 Response", async t => {
	const response = await request.post("api/v1.0/authentication/logout").set("Authorization", testData.securityToken);
	t.is(response.status, 200);
});
github peterjoseph / Reeve / tests_integration / 01_authentication.js View on Github external
test("Create New Client - Valid Body - 200 Response", async t => {
	const response = await request.post("api/v1.0/authentication/register").send({
		workspaceURL: testData.workspaceURL,
		firstName: testData.firstName,
		lastName: testData.lastName,
		emailAddress: testData.emailAddress,
		password: testData.password,
		privacyConsent: testData.privacyConsent,
		language: testData.language
	});
	t.is(response.status, 200);
});
github peterjoseph / Reeve / tests_integration / 01_authentication.js View on Github external
test("Create New Client - Missing Body Content - 403 Response", async t => {
	const response = await request.post("api/v1.0/authentication/register");
	t.is(response.status, 403);
	t.deepEqual(response.body.reason.emailAddress, ["Error: Field cannot be blank."]);
	t.deepEqual(response.body.reason.password, ["Error: Field cannot be blank."]);
	t.deepEqual(response.body.reason.workspaceURL, ["Error: Field cannot be blank."]);
});
github polonel / trudesk / test / api / users.js View on Github external
function (cb) {
          user.aGrps = undefined
          request
            .post('/api/v1/users/create')
            .set('accesstoken', tdapikey)
            .set('Content-Type', 'application/json')
            .send(user)
            .set('Accept', 'application/json')
            .expect(
              400,
              {
                success: false,
                error: 'Invalid Group Array'
              },
              cb
            )
        },
        function (cb) {
github DavidAnson / PassWeb / Test / RemoteStorage.js View on Github external
.expect(200, "", function() {
                    request
                      .post("")
                      .type("form")
                      .send({ method: "get", name: "post-file.txt" })
                      .expect("Content-Type", /^text\/plain/)
                      .expect(200, "Bye.", function() {
                        request
                          .post("")
                          .type("form")
                          .send({ method: "delete", name: "post-file.txt" })
                          .expect("Content-Type", /^text\/plain/)
                          .expect(200, "", done);
                      });
                  });
              });

supertest

SuperAgent driven library for testing HTTP servers

MIT
Latest version published 6 months ago

Package Health Score

84 / 100
Full package analysis