
com.peachapisecurity.tg.junit4.examples.TestUsers Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tg-junit4 Show documentation
Show all versions of tg-junit4 Show documentation
Peach API Security JUnit4 Integration
The newest version!
/*
* Copyright 2017 Peach Tech
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.peachapisecurity.tg.junit4.examples;
import java.net.URI;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.client.fluent.Request;
import org.apache.http.entity.ContentType;
import org.apache.http.util.EntityUtils;
import org.json.JSONObject;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.Assert;
/**
* Example JUnit4 tests for Flask Rest Target
*/
public class TestUsers {
private static String _baseUrl = null;
private int _lastUserId = 2;
private static String _apiToken = "Token b5638ae7-6e77-4585-b035-7d9de2e3f6b3";
public static HttpHost Proxy = null;
@BeforeClass
public static void setupClass() throws Throwable
{
_baseUrl = System.getenv("TARGET_URL");
}
@Test
public void getAllUsers() throws Throwable
{
Request
.Get(String.format("%s/api/users", _baseUrl))
.addHeader("Authorization", _apiToken)
.viaProxy(Proxy)
.execute()
.returnResponse();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy