|
@@ -41,6 +41,12 @@ class ONURESTControllerTest extends WebTestCaseBase
|
|
|
json_encode(array(array("name" => "Stock", "id" => 1)));
|
|
|
$datos['api/devices/check'] =
|
|
|
json_encode(array(array('result' => true, 'errors' => null)));
|
|
|
+ $datos['api/devices'] =
|
|
|
+ json_encode(array('id' => 1));
|
|
|
+
|
|
|
+ $datos["client"] = array(array("id"=> 1));
|
|
|
+
|
|
|
+
|
|
|
return $datos;
|
|
|
}
|
|
|
|
|
@@ -60,7 +66,7 @@ class ONURESTControllerTest extends WebTestCaseBase
|
|
|
$datos['mac'] = '00:11:22:33';
|
|
|
$datos['ponSerialNumber'] = 'pon';
|
|
|
$datos['clientId'] = array('name' => 'Stock GZ [pruebass]');
|
|
|
- $datos['transitionState'] = 'ts';
|
|
|
+ //$datos['transitionState'] = 'ts';
|
|
|
$datos['tenancyId'] = 1;
|
|
|
$datos['deviceId'] = 1;
|
|
|
|
|
@@ -115,6 +121,8 @@ class ONURESTControllerTest extends WebTestCaseBase
|
|
|
$this->getClient()->request('POST', $this->getUri(), $this->obtainData());
|
|
|
// obtengo la respuesta
|
|
|
$response = $this->getClient()->getResponse();
|
|
|
+
|
|
|
+ var_dump($response->getContent());
|
|
|
$this->assertEquals(201, $response->getStatusCode(), "Error en la respuesta http.");
|
|
|
}
|
|
|
|
|
@@ -174,6 +182,42 @@ class ONURESTControllerTest extends WebTestCaseBase
|
|
|
$this->assertContains('pon_modifi', strtolower($response->getContent()), "Error al buscar al onu modificado.");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Aplica una transicion de un workflow a una entidad
|
|
|
+ * apply_onus -> /api/onu/{id}/apply/{workflow}/{transition}.{_format}
|
|
|
+ * controller: ClientBundle:ClientREST:cget
|
|
|
+ * Method: GET
|
|
|
+ */
|
|
|
+ public function testAPPLY()
|
|
|
+ {
|
|
|
+ $this->initDefault($this->obtainDataWebService());
|
|
|
+ $response = $this->generateGET();
|
|
|
+ // verifco el resultado
|
|
|
+ $this->assertEquals(200, $response->getStatusCode(), "Error en la respuesta http.");
|
|
|
+ $this->assertJson($json = $response->getContent(), "No se obtuvo un objeto json.");
|
|
|
+
|
|
|
+ $json = json_decode($json, true);
|
|
|
+ $json = $json[0];
|
|
|
+
|
|
|
+ $this->assertEquals("active", $json["administrativeState"]);
|
|
|
+
|
|
|
+ $this->initDefault($this->obtainDataWebService());
|
|
|
+
|
|
|
+ $original = $this->getClient()->getContainer()->get('device.device_listener');
|
|
|
+ $fakeWebService = $this->getClient()->getContainer()->get('webservice');
|
|
|
+ $original->setWebservice($fakeWebService);
|
|
|
+
|
|
|
+ $this->getClient()->request('PATCH',
|
|
|
+ $this->getUriPutDelete(). $json["id"] . "/apply/administrative_state/active_to_suspend.json" , array());
|
|
|
+ $response = $this->getClient()->getResponse();
|
|
|
+
|
|
|
+ $json = json_decode($response->getContent(), true);
|
|
|
+
|
|
|
+ $this->assertEquals(201, $response->getStatusCode(), "Error en la respuesta http.");
|
|
|
+ $this->assertEquals("suspend", $json["administrativeState"]);
|
|
|
+
|
|
|
+ $response = $this->getClient()->getResponse();
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* Realiza una baja.
|