vendredi 30 septembre 2016

Codeception POST error with Propel

I have an error where i make a POST request using codeception, and I get an sql exception saying I cant insert. But if I try the same POST request on Postman it works wonderfully. This project is using propel as an ORM. Here is my api.suite.yml file:

class_name: ApiTester modules: enabled: - \Helper\Api - Asserts - Laravel5 - Db - REST: url: http://localhost:8000/ depends: Laravel5 config: Laravel5: environment_file: .env.testing

and here is my snippet of code in question:

public function crearActividad(ApiTester $I) {
$I->wantTo('Crear un recurso actividad y verificar que lo obtenemos');
$I->amBearerAuthenticated($this->token);
$I->sendPOST($this->url, [
    'CodProceso' => 1,
    'Nombre'     => 'Actividad Nueva Nueva',
]);
$this->logResponse($I);
$this->checkResponseCode($I, HttpCode::CREATED);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(array(
    'estado' => true,
    'codigo' => config('constants.ESTADOS_PROCESOS.OK'),
    'Actividades' => [[
        'CodProceso' => 1,
        'Nombre'     => 'Actividad Nueva Nueva',
     ]],
  ));
}

The error im getting is this:

Unable to execute INSERT statement [INSERT INTO app.actividad (cod_actividad, nombre, cod_pr oceso) VALUES (:p0, :p1, :p2)]



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire