mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
41 lines
1.4 KiB
Java
41 lines
1.4 KiB
Java
package org.alfresco.rest.v1;
|
|
|
|
import org.alfresco.rest.RestSitesApi;
|
|
import org.alfresco.rest.exception.JsonToModelConversionException;
|
|
import org.alfresco.utility.model.UserModel;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.testng.Assert;
|
|
import org.testng.annotations.BeforeClass;
|
|
import org.testng.annotations.Test;
|
|
|
|
public class SampleATest extends RestTest
|
|
{
|
|
@Autowired
|
|
RestSitesApi siteAPI;
|
|
|
|
@BeforeClass
|
|
public void initTest()
|
|
{
|
|
siteAPI.useRestClient(restClient);
|
|
}
|
|
|
|
@Test(groups = {"rest-api-v1", "sanity"})
|
|
public void sampleATestMethod1() throws JsonToModelConversionException
|
|
{
|
|
UserModel admin = new UserModel("admin", "admin");
|
|
restClient.authenticateUser(admin);
|
|
|
|
Assert.assertFalse(siteAPI.getSites().getEntries().isEmpty(), "We have sites");
|
|
}
|
|
|
|
@Test(groups = {"rest-api-v1", "sanity"})
|
|
public void sampleATestMethod2() throws JsonToModelConversionException
|
|
{
|
|
UserModel admin = new UserModel("admin", "a");
|
|
restClient.authenticateUser(admin);
|
|
Assert.assertTrue(siteAPI.getSites().getEntries().isEmpty(), "We have sites");
|
|
Assert.assertEquals(siteAPI.usingRestWrapper().getLastStatus().getName().toLowerCase(), HttpStatus.UNAUTHORIZED.name().toLowerCase(), "Status Code Name");
|
|
}
|
|
}
|