mirror of
https://github.com/Voronsky/unifi4j.git
synced 2025-12-12 16:16:34 -05:00
Refactored Unit tests based on rework
This commit is contained in:
@@ -13,32 +13,21 @@ public class UnifiTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void GetHostTest(){
|
public void GetHostTest(){
|
||||||
ResponseEntity<String> response;
|
String response;
|
||||||
System.out.println("UNIFI_KEY: "+System.getenv("UNIFI_KEY"));
|
System.out.println("UNIFI_KEY: "+System.getenv("UNIFI_KEY"));
|
||||||
Unifi unifi = new Unifi("https://api.ui.com/ea", System.getenv("UNIFI_KEY"));
|
Unifi unifi = new Unifi("https://api.ui.com/ea", System.getenv("UNIFI_KEY"));
|
||||||
response = unifi.getHosts();
|
response = unifi.getHosts();
|
||||||
System.out.println("Status Code:" + response.getStatusCode());
|
System.out.println(response);
|
||||||
System.out.println("Content: "+response.getBody());
|
|
||||||
|
|
||||||
assert response.getStatusCode().is2xxSuccessful();
|
|
||||||
assert !response.getBody().isEmpty();
|
|
||||||
|
|
||||||
try{
|
|
||||||
JSONObject jsonObject = new JSONObject(response.getBody());
|
|
||||||
System.out.println(jsonObject);
|
|
||||||
} catch (JSONException err){
|
|
||||||
System.out.println(err.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void GetHardwaresTest(){
|
public void GetHardwareListTest(){
|
||||||
List<String> response = new ArrayList<>();
|
List<String> response = new ArrayList<>();
|
||||||
System.out.println("UNIFI_KEY: "+System.getenv("UNIFI_KEY"));
|
System.out.println("UNIFI_KEY: "+System.getenv("UNIFI_KEY"));
|
||||||
Unifi unifi = new Unifi("https://api.ui.com/ea", System.getenv("UNIFI_KEY"));
|
Unifi unifi = new Unifi("https://api.ui.com/ea", System.getenv("UNIFI_KEY"));
|
||||||
try {
|
try {
|
||||||
response = unifi.getHardware();
|
response = unifi.getHardwareList();
|
||||||
}
|
}
|
||||||
catch(Exception e){
|
catch(Exception e){
|
||||||
System.out.println("Exception: "+e);
|
System.out.println("Exception: "+e);
|
||||||
|
|||||||
Reference in New Issue
Block a user