From b39d96104b95ab4ac8a94f632efcbbaf283e4d15 Mon Sep 17 00:00:00 2001
From: lukasmatusiewicz <lukas.matusiewicz@netknights.it>
Date: Fri, 27 Jan 2023 10:20:26 +0100
Subject: [PATCH] 30 update the test utils (#33)

* Update Utils.php

* Update the tests

make the tests better to read

* Update runTests.yml

* Update runTests.yml

* Update runTests.yml

* Update phpunit.xml

add json coverage file

* Update runTests.yml

* Update runTests.yml

* Update runTests.yml

* Update phpunit.xml

* Update runTests.yml

* Update runTests.yml

* Update phpunit.xml

* formatting
---
 .github/workflows/runTests.yml     |   7 +-
 src/AuthenticationStatus.php       |   1 +
 src/PIBadRequestException.php      |   3 +-
 src/PrivacyIDEA.php                |   2 +-
 test/EnrollTokenTest.php           |  71 ++-----
 test/PollTransactionTest.php       |  45 +----
 test/TriggerChallengeTest.php      |  37 +---
 test/ValidateCheckTest.php         |  18 +-
 test/ValidateCheckU2FTest.php      |  50 ++---
 test/ValidateCheckWebauthnTest.php |  64 +------
 test/utils/Utils.php               | 287 +++++++++++++++++++++++++++++
 test/utils/UtilsForTests.php       |  44 -----
 test/utils/phpunit.xml             |   9 +-
 13 files changed, 353 insertions(+), 285 deletions(-)
 create mode 100644 test/utils/Utils.php
 delete mode 100644 test/utils/UtilsForTests.php

diff --git a/.github/workflows/runTests.yml b/.github/workflows/runTests.yml
index 4cc0887..7118dd1 100644
--- a/.github/workflows/runTests.yml
+++ b/.github/workflows/runTests.yml
@@ -41,12 +41,7 @@ jobs:
         args: --coverage-text
       env:
         XDEBUG_MODE: coverage
-      
-    - name: Update coverage badge
-      uses: timkrase/phpunit-coverage-badge@v1.2.0
-      with:
-        report: test/utils/_coverage/clover.xml
-        report_type: clover
+        
 
       
       
diff --git a/src/AuthenticationStatus.php b/src/AuthenticationStatus.php
index f19502c..07787d8 100644
--- a/src/AuthenticationStatus.php
+++ b/src/AuthenticationStatus.php
@@ -1,4 +1,5 @@
 <?php
+
 abstract class AuthenticationStatus
 {
     const CHALLENGE = "CHALLENGE";
diff --git a/src/PIBadRequestException.php b/src/PIBadRequestException.php
index 0b7d677..0d11e6c 100644
--- a/src/PIBadRequestException.php
+++ b/src/PIBadRequestException.php
@@ -3,4 +3,5 @@
 //namespace PrivacyIdea\PHPClient;
 
 class PIBadRequestException extends Exception
-{}
+{
+}
diff --git a/src/PrivacyIDEA.php b/src/PrivacyIDEA.php
index 80c9c71..1a36f21 100644
--- a/src/PrivacyIDEA.php
+++ b/src/PrivacyIDEA.php
@@ -373,7 +373,7 @@ class PrivacyIDEA
      * @param $httpMethod string GET or POST
      * @param $endpoint string endpoint of the privacyIDEA API (e.g. /validate/check)
      * @return string returns a string with the response from server
-     * @throws PIBadRequestException if an error occurres
+     * @throws PIBadRequestException if an error occurs
      */
     public function sendRequest(array $params, array $headers, $httpMethod, $endpoint)
     {
diff --git a/test/EnrollTokenTest.php b/test/EnrollTokenTest.php
index 8b04f02..5d26446 100644
--- a/test/EnrollTokenTest.php
+++ b/test/EnrollTokenTest.php
@@ -1,12 +1,12 @@
 <?php
 
-require_once(__DIR__ . '/../src/Client-Autoloader.php');
+//require_once(__DIR__ . '/../src/Client-Autoloader.php');
 require_once(__DIR__ . '/../vendor/autoload.php');
-require_once("utils/UtilsForTests.php");
+require_once("utils/Utils.php");
 
 use InterNations\Component\HttpMock\PHPUnit\HttpMockTrait;
 use PHPUnit\Framework\TestCase;
-use utils\UtilsForTests;
+use utils\Utils;
 
 class EnrollTokenTest extends TestCase implements PILog
 {
@@ -42,35 +42,7 @@ class EnrollTokenTest extends TestCase implements PILog
      */
     public function testSuccess()
     {
-        $authToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NoBVmAurqcaaMmwM-AsD1S6chGIM";
-
-        $img = "data:image/png;base64,iVBdgfgsdfgRK5CYII=";
-
-        $responseBodyAuth = UtilsForTests::authToken($authToken);
-
-        $responseBodyTokenInit = "{\n" . "    \"detail\": {\n" . "        \"googleurl\": {\n" .
-            "            \"description\": \"URL for google Authenticator\",\n" .
-            "            \"img\": \"data:image/png;base64,iVBdgfgsdfgRK5CYII=\",\n" .
-            "            \"value\": \"otpauth://hotp/OATH0003A0AA?secret=4DK5JEEQMWY3VES7EWB4M36TAW4YC2YH&counter=1&digits=6&issuer=privacyIDEA\"\n" .
-            "        },\n" . "        \"oathurl\": {\n" .
-            "            \"description\": \"URL for OATH token\",\n" .
-            "            \"img\": \"data:image/png;base64,iVBdgfgsdfgRK5CYII=\",\n" .
-            "            \"value\": \"oathtoken:///addToken?name=OATH0003A0AA&lockdown=true&key=e0d5d4909065b1ba925f2583c66fd305b9816b07\"\n" .
-            "        },\n" . "        \"otpkey\": {\n" .
-            "            \"description\": \"OTP seed\",\n" .
-            "            \"img\": \"data:image/png;base64,iVBdgfgsdfgRK5CYII=\",\n" .
-            "            \"value\": \"seed://e0d5d4909065b1ba925f2583c66fd305b9816b07\",\n" .
-            "            \"value_b32\": \"4DK5JEEQMWY3VES7EWB4M36TAW4YC2YH\"\n" .
-            "        },\n" . "        \"rollout_state\": \"\",\n" .
-            "        \"serial\": \"OATH0003A0AA\",\n" .
-            "        \"threadid\": 140470638720768\n" . "    },\n" .
-            "    \"id\": 1,\n" . "    \"jsonrpc\": \"2.0\",\n" .
-            "    \"result\": {\n" . "        \"status\": true,\n" .
-            "        \"value\": true\n" . "    },\n" .
-            "    \"time\": 1592834605.532012,\n" .
-            "    \"version\": \"privacyIDEA 3.3.3\",\n" .
-            "    \"versionnumber\": \"3.3.3\",\n" .
-            "    \"signature\": \"rsa_sha256_pss:\"\n" . "}";
+        $responseBodyAuth = Utils::postAuthResponseBody();
 
         $this->http->mock
             ->when()
@@ -84,10 +56,10 @@ class EnrollTokenTest extends TestCase implements PILog
         $this->http->mock
             ->when()
             ->methodIs('POST')
-            ->headerIs("Authorization", $authToken)
+            ->headerIs("Authorization", Utils::authToken())
             ->pathIs('/token/init')
             ->then()
-            ->body($responseBodyTokenInit)
+            ->body(Utils::tokenInitResponseBody())
             ->end();
         $this->http->setUp();
 
@@ -104,7 +76,7 @@ class EnrollTokenTest extends TestCase implements PILog
         $this->assertNotNull($response);
         $this->assertIsObject($response);
         $this->assertObjectHasAttribute('detail', $response);
-        $this->assertEquals($img, $response->detail->googleurl->img);
+        $this->assertEquals(Utils::imageData(), $response->detail->googleurl->img);
     }
 
     /**
@@ -114,9 +86,9 @@ class EnrollTokenTest extends TestCase implements PILog
     {
         $response = $this->pi->enrollToken(
             "testUser",
-        "1",
-        "totp",
-        "Enrolled for test");
+            "1",
+            "totp",
+            "Enrolled for test");
 
         $this->assertNull($response);
     }
@@ -140,39 +112,22 @@ class EnrollTokenTest extends TestCase implements PILog
      */
     public function testUserAlreadyHasAToken()
     {
-        $authToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NoBVmAurqcaaMmwM-AsD1S6chGIM";
-
-        $responseBodyAuth = UtilsForTests::authToken($authToken);
-
-        $responseBodyGetToken = "{\"id\":1," . "\"jsonrpc\":\"2.0\"," . "\"result\":{" . "\"status\":true," . "\"value\":{" .
-            "\"count\":1," . "\"current\":1," . "\"tokens\":[{" . "\"active\":true," . "\"count\":2," .
-            "\"count_window\":10," . "\"description\":\"\"," . "\"failcount\":0," . "\"id\":347," .
-            "\"info\":{" . "\"count_auth\":\"1\"," . "\"count_auth_success\":\"1\"," .
-            "\"hashlib\":\"sha1\"," . "\"last_auth\":\"2022-03-2912:18:59.639421+02:00\"," .
-            "\"tokenkind\":\"software\"}," . "\"locked\":false," . "\"maxfail\":10," . "\"otplen\":6," .
-            "\"realms\":[\"defrealm\"]," . "\"resolver\":\"deflocal\"," . "\"revoked\":false," .
-            "\"rollout_state\":\"\"," . "\"serial\":\"OATH00123564\"," . "\"sync_window\":1000," .
-            "\"tokentype\":\"hotp\"," . "\"user_editable\":false," . "\"user_id\":\"5\"," .
-            "\"user_realm\":\"defrealm\"," . "\"username\":\"Test\"}]}}," . "\"time\":1648549489.57896," .
-            "\"version\":\"privacyIDEA3.6.3\"," . "\"versionnumber\":\"3.6.3\"," .
-            "\"signature\":\"rsa_sha256_pss:58c4eed1...5247c47e3e\"}";
-
         $this->http->mock
             ->when()
             ->methodIs('POST')
             ->pathIs('/auth')
             ->then()
-            ->body($responseBodyAuth)
+            ->body(Utils::postAuthResponseBody())
             ->end();
         $this->http->setUp();
 
         $this->http->mock
             ->when()
             ->methodIs('GET')
-            ->headerIs("Authorization", $authToken)
+            ->headerIs("Authorization", Utils::authToken())
             ->pathIs('/token')
             ->then()
-            ->body($responseBodyGetToken)
+            ->body(Utils::getTokenResponseBody())
             ->end();
         $this->http->setUp();
 
diff --git a/test/PollTransactionTest.php b/test/PollTransactionTest.php
index 7376cd9..80d947e 100644
--- a/test/PollTransactionTest.php
+++ b/test/PollTransactionTest.php
@@ -1,10 +1,12 @@
 <?php
 
-require_once(__DIR__ . '/../src/Client-Autoloader.php');
+//require_once(__DIR__ . '/../src/Client-Autoloader.php');
 require_once(__DIR__ . '/../vendor/autoload.php');
+require_once("utils/Utils.php");
 
 use InterNations\Component\HttpMock\PHPUnit\HttpMockTrait;
 use PHPUnit\Framework\TestCase;
+use utils\Utils;
 
 class PollTransactionTest extends TestCase implements PILog
 {
@@ -38,35 +40,14 @@ class PollTransactionTest extends TestCase implements PILog
     /**
      * @throws PIBadRequestException
      */
-    public function testTriggerPUSH()
+    public function testTriggerPushToken()
     {
-        $responseBody = "{\n" . "  \"detail\": {\n" . "\"preferred_client_mode\":\"poll\"," . "    \"attributes\": null,\n" .
-            "    \"message\": \"Bitte geben Sie einen OTP-Wert ein: , Please confirm the authentication on your mobile device!\",\n" .
-            "    \"messages\": [\n" . "      \"Bitte geben Sie einen OTP-Wert ein: \",\n" .
-            "      \"Please confirm the authentication on your mobile device!\"\n" . "    ],\n" .
-            "    \"multi_challenge\": [\n" . "      {\n" . "        \"attributes\": null,\n" .
-            "        \"message\": \"Bitte geben Sie einen OTP-Wert ein: \",\n" .
-            "        \"serial\": \"OATH00020121\",\n" .
-            "        \"transaction_id\": \"02659936574063359702\",\n" . "        \"type\": \"hotp\"\n" .
-            "      },\n" . "      {\n" . "        \"attributes\": null,\n" .
-            "        \"message\": \"Please confirm the authentication on your mobile device!\",\n" .
-            "        \"serial\": \"PIPU0001F75E\",\n" .
-            "        \"transaction_id\": \"02659936574063359702\",\n" . "        \"type\": \"push\"\n" .
-            "      }\n" . "    ],\n" . "    \"serial\": \"PIPU0001F75E\",\n" .
-            "    \"threadid\": 140040525666048,\n" . "    \"transaction_id\": \"02659936574063359702\",\n" .
-            "    \"transaction_ids\": [\n" . "      \"02659936574063359702\",\n" .
-            "      \"02659936574063359702\"\n" . "    ],\n" . "    \"type\": \"push\"\n" . "  },\n" .
-            "  \"id\": 1,\n" . "  \"jsonrpc\": \"2.0\",\n" . "  \"result\": {\n" .
-            "    \"status\": true,\n" . "    \"value\": false\n" . "  },\n" .
-            "  \"time\": 1589360175.594304,\n" . "  \"version\": \"privacyIDEA 3.2.1\",\n" .
-            "  \"versionnumber\": \"3.2.1\",\n" . "  \"signature\": \"rsa_sha256_pss:AAAAAAAAAA\"\n" . "}";
-
         $this->http->mock
             ->when()
             ->methodIs('POST')
             ->pathIs('/validate/check')
             ->then()
-            ->body($responseBody)
+            ->body(Utils::triggerPushTokenResponseBody())
             ->end();
         $this->http->setUp();
 
@@ -79,7 +60,7 @@ class PollTransactionTest extends TestCase implements PILog
         $this->assertIsArray($response->multiChallenge);
         $this->assertTrue($response->status);
         $this->assertFalse($response->value);
-        $this->assertEquals($responseBody, $response->raw);
+        $this->assertEquals(Utils::triggerPushTokenResponseBody(), $response->raw);
         $this->assertEquals("Please confirm the authentication on your mobile device!", $response->pushMessage());
         $this->assertEquals("hotp", $response->triggeredTokenTypes()[0]);
         $this->assertEquals("push", $response->triggeredTokenTypes()[1]);
@@ -90,24 +71,12 @@ class PollTransactionTest extends TestCase implements PILog
      */
     public function testSuccess()
     {
-        $respPolling = '{
-                "id": 1,
-          "jsonrpc": "2.0",
-          "result": {
-                    "status": true,
-            "value": true
-          },
-          "version": "privacyIDEA 3.5.2",
-          "versionnumber": "3.5.2",
-          "signature": "rsa_sha256_pss:12345"
-        }';
-
         $this->http->mock
             ->when()
             ->methodIs('GET')
             ->pathIs('/validate/polltransaction')
             ->then()
-            ->body($respPolling)
+            ->body(Utils::pollingResponseBody())
             ->end();
         $this->http->setUp();
 
diff --git a/test/TriggerChallengeTest.php b/test/TriggerChallengeTest.php
index 8f93922..fbfaed0 100644
--- a/test/TriggerChallengeTest.php
+++ b/test/TriggerChallengeTest.php
@@ -1,12 +1,12 @@
 <?php
 
-require_once(__DIR__ . '/../src/Client-Autoloader.php');
+//require_once(__DIR__ . '/../src/Client-Autoloader.php');
 require_once(__DIR__ . '/../vendor/autoload.php');
-require_once('utils/UtilsForTests.php');
+require_once('utils/Utils.php');
 
 use InterNations\Component\HttpMock\PHPUnit\HttpMockTrait;
 use PHPUnit\Framework\TestCase;
-use utils\UtilsForTests;
+use utils\Utils;
 
 class TriggerChallengeTest extends TestCase implements PILog
 {
@@ -42,30 +42,12 @@ class TriggerChallengeTest extends TestCase implements PILog
      */
     public function testTriggerChallengeSuccess()
     {
-        $responseBody = "{\"detail\":{" . "\"preferred_client_mode\":\"interactive\"," .
-            "\"image\": \"data:image/png;base64,iVBdgfgsdfgRK5CYII=\",\n" .
-            "\"attributes\":null," . "\"message\":\"BittegebenSieeinenOTP-Wertein:\"," .
-            "\"messages\":[\"BittegebenSieeinenOTP-Wertein:\"]," . "\"multi_challenge\":[{" .
-            "\"attributes\":null," . "\"message\":\"BittegebenSieeinenOTP-Wertein:\"," .
-            "\"serial\":\"TOTP00021198\"," . "\"client_mode\":\"interactive\"," . "\"image\":\"dataimage\"," .
-            "\"transaction_id\":\"16734787285577957577\"," . "\"type\":\"totp\"}]," . "\"serial\":\"TOTP00021198\"," .
-            "\"threadid\":140050885818112," . "\"transaction_id\":\"16734787285577957577\"," .
-            "\"transaction_ids\":[\"16734787285577957577\"]," . "\"type\":\"totp\"}," . "\"id\":1," .
-            "\"jsonrpc\":\"2.0\"," . "\"result\":{" . "\"status\":true," . "\"value\":false}," .
-            "\"time\":1649666174.5351279," . "\"version\":\"privacyIDEA3.6.3\"," .
-            "\"versionnumber\":\"3.6.3\"," .
-            "\"signature\":\"rsa_sha256_pss:4b0f0e12c2...89409a2e65c87d27b\"}";
-
-        $authToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwicmVhbG0iOiIiLCJub25jZSI6IjVjOTc4NWM5OWU";
-
-        $responseBodyAuth = UtilsForTests::authToken($authToken);
-
         $this->http->mock
             ->when()
             ->methodIs('POST')
             ->pathIs('/validate/triggerchallenge')
             ->then()
-            ->body($responseBody)
+            ->body(Utils::tcSuccessResponseBody())
             ->end();
         $this->http->setUp();
 
@@ -74,7 +56,7 @@ class TriggerChallengeTest extends TestCase implements PILog
             ->methodIs('POST')
             ->pathIs('/auth')
             ->then()
-            ->body($responseBodyAuth)
+            ->body(Utils::postAuthResponseBody())
             ->end();
         $this->http->setUp();
 
@@ -83,15 +65,12 @@ class TriggerChallengeTest extends TestCase implements PILog
         $this->pi->serviceAccountRealm = "testServiceRealm";
 
         $response = $this->pi->triggerchallenge("testUser");
-        $multiChallenge = $response->multiChallenge;
-
-        $multiChallenge = $response->multiChallenge;
 
         $this->assertEquals("BittegebenSieeinenOTP-Wertein:", $response->message);
         $this->assertEquals("BittegebenSieeinenOTP-Wertein:", $response->messages);
         $this->assertEquals("16734787285577957577", $response->transactionID);
         $this->assertEquals("otp", $response->preferredClientMode);
-        $this->assertEquals("data:image/png;base64,iVBdgfgsdfgRK5CYII=", $response->image);
+        $this->assertEquals(Utils::imageData(), $response->image);
         $this->assertTrue($response->status);
         $this->assertFalse($response->value);
         $this->assertEquals("totp", $response->triggeredTokenTypes()[0]);
@@ -99,8 +78,8 @@ class TriggerChallengeTest extends TestCase implements PILog
         $this->assertEquals("", $response->webauthnMessage());
         $this->assertEquals("", $response->u2fMessage());
         $this->assertEquals("", $response->pushMessage());
-        $this->assertEquals("dataimage", $multiChallenge[0]->image);
-        $this->assertEquals("interactive", $multiChallenge[0]->clientMode);
+        $this->assertEquals(Utils::imageData(), $response->multiChallenge[0]->image);
+        $this->assertEquals("interactive", $response->multiChallenge[0]->clientMode);
     }
 
     /**
diff --git a/test/ValidateCheckTest.php b/test/ValidateCheckTest.php
index b8dcb66..d53c15f 100644
--- a/test/ValidateCheckTest.php
+++ b/test/ValidateCheckTest.php
@@ -1,12 +1,12 @@
 <?php
 
-require_once(__DIR__ . '/../src/Client-Autoloader.php');
+//require_once(__DIR__ . '/../src/Client-Autoloader.php');
 require_once(__DIR__ . '/../vendor/autoload.php');
-require_once('utils/UtilsForTests.php');
+require_once('utils/Utils.php');
 
 use InterNations\Component\HttpMock\PHPUnit\HttpMockTrait;
 use PHPUnit\Framework\TestCase;
-use utils\UtilsForTests;
+use utils\Utils;
 
 class ValidateCheckTest extends TestCase implements PILog
 {
@@ -50,14 +50,14 @@ class ValidateCheckTest extends TestCase implements PILog
             ->methodIs('POST')
             ->pathIs('/validate/check')
             ->then()
-            ->body(UtilsForTests::responseBodySuccess())
+            ->body(Utils::matchingOneTokenResponseBody())
             ->end();
         $this->http->setUp();
 
         $response = $this->pi->validateCheck("testUser", "testPass");
 
         $this->assertEquals("matching 1 tokens", $response->message);
-        $this->assertEquals(UtilsForTests::responseBodySuccess(), $response->raw);
+        $this->assertEquals(Utils::matchingOneTokenResponseBody(), $response->raw);
         $this->assertTrue($response->status);
         $this->assertTrue($response->value);
         $this->assertEquals("", $response->otpMessage());
@@ -97,18 +97,12 @@ class ValidateCheckTest extends TestCase implements PILog
      */
     public function testUserNotFound()
     {
-        $responseBody =
-            "{" . "\"detail\":null," . "\"id\":1," . "\"jsonrpc\":\"2.0\"," . "\"result\":{" . "\"error\":{" .
-            "\"code\":904," . "\"message\":\"ERR904: The user can not be found in any resolver in this realm!\"}," .
-            "\"status\":false}," . "\"time\":1649752303.65651," . "\"version\":\"privacyIDEA 3.6.3\"," .
-            "\"signature\":\"rsa_sha256_pss:1c64db29cad0dc127d6...5ec143ee52a7804ea1dc8e23ab2fc90ac0ac147c0\"}";
-
         $this->http->mock
             ->when()
             ->methodIs('POST')
             ->pathIs('/validate/check')
             ->then()
-            ->body($responseBody)
+            ->body(Utils::errorUserNotFoundResponseBody())
             ->end();
         $this->http->setUp();
 
diff --git a/test/ValidateCheckU2FTest.php b/test/ValidateCheckU2FTest.php
index 6ef0489..1085177 100644
--- a/test/ValidateCheckU2FTest.php
+++ b/test/ValidateCheckU2FTest.php
@@ -1,12 +1,12 @@
 <?php
 
-require_once(__DIR__ . '/../src/Client-Autoloader.php');
+//require_once(__DIR__ . '/../src/Client-Autoloader.php');
 require_once(__DIR__ . '/../vendor/autoload.php');
-require_once('utils/UtilsForTests.php');
+require_once('utils/Utils.php');
 
 use InterNations\Component\HttpMock\PHPUnit\HttpMockTrait;
 use PHPUnit\Framework\TestCase;
-use utils\UtilsForTests;
+use utils\Utils;
 
 class ValidateCheckU2FTest extends TestCase implements PILog
 {
@@ -42,37 +42,12 @@ class ValidateCheckU2FTest extends TestCase implements PILog
      */
     public function testTriggerU2F()
     {
-        $u2frequest =  "{\"appId\":\"https:\/\/ttype.u2f\"," .
-            "\"challenge\":\"TZKiB0VFFMFsnlz00lF5iCqtQduDJf56AeJAY_BT4NU\"," .
-            "\"keyHandle\":\"UUHmZ4BUFCrt7q88MhlQJYu4G5qB9l7ScjRRxA-M35cTH-uHWyMEpxs4WBzbkjlZqzZW1lC-jDdFd2pKDUsNnA\"," .
-            "\"version\":\"U2F_V2\"}";
-
-        $responseBody = "{" . "\"detail\":{" . "\"preferred_client_mode\":\"u2f\"," . "\"attributes\":{" . "\"hideResponseInput\":true," .
-        "\"img\":\"static/img/FIDO-U2F-Security-Key-444x444.png\"," . "\"u2fSignRequest\":{" .
-        "\"appId\":\"http//ttype.u2f\"," . "\"challenge\":\"TZKiB0VFFMF...tQduDJf56AeJAY_BT4NU\"," .
-        "\"keyHandle\":\"UUHmZ4BUFCrt7q88MhlQ...qzZW1lC-jDdFd2pKDUsNnA\"," .
-        "\"version\":\"U2F_V2\"}}," .
-        "\"message\":\"Please confirm with your U2F token (Yubico U2F EE Serial 61730834)\"," .
-        "\"messages\":[\"Please confirm with your U2F token (Yubico U2F EE Serial 61730834)\"]," .
-        "\"multi_challenge\":[{" . "\"attributes\":{" . "\"hideResponseInput\":true," .
-        "\"img\":\"static/img/FIDO-U2F-Security-Key-444x444.png\"," . "\"u2fSignRequest\":" .
-        $u2frequest . "}," .
-        "\"message\":\"Please confirm with your U2F token (Yubico U2F EE Serial 61730834)\"," .
-        "\"serial\":\"U2F00014651\"," . "\"transaction_id\":\"12399202888279169736\"," .
-        "\"type\":\"u2f\"}]," . "\"serial\":\"U2F00014651\"," . "\"threadid\":140050978137856," .
-        "\"transaction_id\":\"12399202888279169736\"," .
-        "\"transaction_ids\":[\"12399202888279169736\"]," . "\"type\":\"u2f\"}," . "\"id\":1," .
-        "\"jsonrpc\":\"2.0\"," . "\"result\":{" . "\"status\":true," . "\"value\":false}," .
-        "\"time\":1649769348.7552881," . "\"version\":\"privacyIDEA 3.6.3\"," .
-        "\"versionnumber\":\"3.6.3\"," .
-        "\"signature\":\"rsa_sha256_pss:3e51d814...dccd5694b8c15943e37e1\"}";
-
         $this->http->mock
             ->when()
             ->methodIs('POST')
             ->pathIs('/validate/check')
             ->then()
-            ->body($responseBody)
+            ->body(Utils::triggerU2FResponseBody())
             ->end();
         $this->http->setUp();
 
@@ -85,11 +60,12 @@ class ValidateCheckU2FTest extends TestCase implements PILog
         $this->assertIsArray($response->multiChallenge);
         $this->assertTrue($response->status);
         $this->assertFalse($response->value);
-        $this->assertEquals($responseBody, $response->raw);
-        $temp = str_replace(" ", "", $u2frequest);
+        $this->assertEquals(Utils::triggerU2FResponseBody(), $response->raw);
+        $this->assertEquals("Please confirm with your U2F token (Yubico U2F EE Serial 61730834)", $response->u2fMessage());
+
+        $temp = str_replace(" ", "", Utils::u2fSignRequest());
         $trimmedSignRequest = str_replace("\n", "", $temp);
         $this->assertEquals($trimmedSignRequest, $response->u2fSignRequest());
-        $this->assertEquals("Please confirm with your U2F token (Yubico U2F EE Serial 61730834)", $response->u2fMessage());
     }
 
     /**
@@ -97,23 +73,19 @@ class ValidateCheckU2FTest extends TestCase implements PILog
      */
     public function testSuccess()
     {
-        $u2fSignResponse = "{\"clientData\":\"eyJjaGFsbGVuZ2UiOiJpY2UBc3NlcnRpb24ifQ\"," . "\"errorCode\":0," .
-            "\"keyHandle\":\"UUHmZ4BUFCrt7q88MhlQkjlZqzZW1lC-jDdFd2pKDUsNnA\"," .
-            "\"signatureData\":\"AQAAAxAwRQIgZwEObruoCRRo738F9up1tdV2M0H1MdP5pkO5Eg\"}";
-
         $this->http->mock
             ->when()
             ->methodIs('POST')
             ->pathIs('/validate/check')
             ->then()
-            ->body(UtilsForTests::responseBodySuccess())
+            ->body(Utils::matchingOneTokenResponseBody())
             ->end();
         $this->http->setUp();
 
-        $response = $this->pi->validateCheckU2F("testUser", "12345678", $u2fSignResponse);
+        $response = $this->pi->validateCheckU2F("testUser", "12345678", Utils::u2fSignResponse());
 
         $this->assertEquals("matching 1 tokens", $response->message);
-        $this->assertEquals(UtilsForTests::responseBodySuccess(), $response->raw);
+        $this->assertEquals(Utils::matchingOneTokenResponseBody(), $response->raw);
         $this->assertTrue($response->status);
         $this->assertTrue($response->value);
     }
diff --git a/test/ValidateCheckWebauthnTest.php b/test/ValidateCheckWebauthnTest.php
index 1c67a13..021c195 100644
--- a/test/ValidateCheckWebauthnTest.php
+++ b/test/ValidateCheckWebauthnTest.php
@@ -1,12 +1,12 @@
 <?php
 
-require_once(__DIR__ . '/../src/Client-Autoloader.php');
+//require_once(__DIR__ . '/../src/Client-Autoloader.php');
 require_once(__DIR__ . '/../vendor/autoload.php');
-require_once('utils/UtilsForTests.php');
+require_once('utils/Utils.php');
 
 use InterNations\Component\HttpMock\PHPUnit\HttpMockTrait;
 use PHPUnit\Framework\TestCase;
-use utils\UtilsForTests;
+use utils\Utils;
 
 class ValidateCheckWebauthnTest extends TestCase implements PILog
 {
@@ -42,51 +42,12 @@ class ValidateCheckWebauthnTest extends TestCase implements PILog
      */
     public function testTriggerWebAuthn()
     {
-        $webauthnSignRequest = "{\n" . "            \"allowCredentials\": [\n" . "              {\n" .
-            "                \"id\": \"83De8z_CNqogB6aCyKs6dWIqwpOpzVoNaJ74lgcpuYN7l-95QsD3z-qqPADqsFlPwBXCMqEPssq75kqHCMQHDA\",\n" .
-            "                \"transports\": [\n" . "                  \"internal\",\n" .
-            "                  \"nfc\",\n" . "                  \"ble\",\n" .
-            "                  \"usb\"\n" . "                ],\n" .
-            "                \"type\": \"public-key\"\n" . "              }\n" .
-            "            ],\n" .
-            "            \"challenge\": \"dHzSmZnAhxEq0szRWMY4EGg8qgjeBhJDjAPYKWfd2IE\",\n" .
-            "            \"rpId\": \"office.netknights.it\",\n" .
-            "            \"timeout\": 60000,\n" .
-            "            \"userVerification\": \"preferred\"\n" . "          }\n";
-
-        $responseBody =
-            "{\n" . "  \"detail\": {\n" . "\"preferred_client_mode\":\"webauthn\"," . "    \"attributes\": {\n" . "      \"hideResponseInput\": true,\n" .
-            "      \"img\": \"static/img/FIDO-U2F-Security-Key-444x444.png\",\n" .
-            "      \"webAuthnSignRequest\": {\n" . "        \"allowCredentials\": [\n" . "          {\n" .
-            "            \"id\": \"83De8z_CNqogB6aCyKs6dWIqwpOpzVoNaJ74lgcpuYN7l-95QsD3z-qqPADqsFlPwBXCMqEPssq75kqHCMQHDA\",\n" .
-            "            \"transports\": [\n" . "              \"internal\",\n" . "              \"nfc\",\n" .
-            "              \"ble\",\n" . "              \"usb\"\n" . "            ],\n" .
-            "            \"type\": \"public-key\"\n" . "          }\n" . "        ],\n" .
-            "        \"challenge\": \"dHzSmZnAhxEq0szRWMY4EGg8qgjeBhJDjAPYKWfd2IE\",\n" .
-            "        \"rpId\": \"office.netknights.it\",\n" . "        \"timeout\": 60000,\n" .
-            "        \"userVerification\": \"preferred\"\n" . "      }\n" . "    },\n" .
-            "    \"message\": \"Please confirm with your WebAuthn token (Yubico U2F EE Serial 61730834)\",\n" .
-            "    \"messages\": [\n" .
-            "      \"Please confirm with your WebAuthn token (Yubico U2F EE Serial 61730834)\"\n" . "    ],\n" .
-            "    \"multi_challenge\": [\n" . "      {\n" . "        \"attributes\": {\n" .
-            "          \"hideResponseInput\": true,\n" .
-            "          \"webAuthnSignRequest\": " . $webauthnSignRequest . "        },\n" .
-            "        \"message\": \"Please confirm with your WebAuthn token (Yubico U2F EE Serial 61730834)\",\n" .
-            "        \"serial\": \"WAN00025CE7\",\n" . "          \"image\": \"dataimage\",\n" .
-            "        \"transaction_id\": \"16786665691788289392\",\n" .
-            "        \"type\": \"webauthn\"\n" . "      }\n" . "    ],\n" . "    \"serial\": \"WAN00025CE7\",\n" .
-            "    \"threadid\": 140040275289856,\n" . "    \"transaction_id\": \"16786665691788289392\",\n" .
-            "    \"transaction_ids\": [\n" . "      \"16786665691788289392\"\n" . "    ],\n" .
-            "    \"type\": \"webauthn\"\n" . "  },\n" . "  \"id\": 1,\n" . "  \"jsonrpc\": \"2.0\",\n" .
-            "  \"result\": {\n" . "    \"authentication\": \"CHALLENGE\",\n" . "    \"status\": true,\n" .
-            "    \"value\": false\n" . "  },\n" . "  \"time\": 1611916339.8448942\n" . "}";
-
         $this->http->mock
             ->when()
             ->methodIs('POST')
             ->pathIs('/validate/check')
             ->then()
-            ->body($responseBody)
+            ->body(Utils::triggerWebauthnResponseBody())
             ->end();
         $this->http->setUp();
 
@@ -100,11 +61,11 @@ class ValidateCheckWebauthnTest extends TestCase implements PILog
         $this->assertEquals("Please confirm with your WebAuthn token (Yubico U2F EE Serial 61730834)", $response->multiChallenge[0]->message);
         $this->assertEquals("WAN00025CE7", $response->multiChallenge[0]->serial);
         $this->assertEquals("webauthn", $response->multiChallenge[0]->type);
-        $this->assertEquals("dataimage", $response->multiChallenge[0]->image);
+        $this->assertEquals(Utils::imageData(), $response->multiChallenge[0]->image);
         $this->assertTrue($response->status);
         $this->assertFalse($response->value);
         $this->assertEquals("Please confirm with your WebAuthn token (Yubico U2F EE Serial 61730834)", $response->webauthnMessage());
-        $temp = str_replace(" ", "", $webauthnSignRequest);
+        $temp = str_replace(" ", "", Utils::webauthnSignRequest());
         $trimmedSignRequest = str_replace("\n", "", $temp);
         $this->assertEquals($trimmedSignRequest, $response->webauthnSignRequest());
     }
@@ -114,26 +75,19 @@ class ValidateCheckWebauthnTest extends TestCase implements PILog
      */
     public function testSuccess()
     {
-        $webauthnSignResponse = "{" . "\"credentialid\":\"X9FrwMfmzj...saw21\"," .
-            "\"authenticatordata\":\"xGzvgq0bVGR3WR0A...ZJdA7cBAAAACA\"," .
-            "\"clientdata\":\"eyJjaGFsbG...dfhs\"," .
-            "\"userhandle\":\"eyJjaGFsadffhs\"," .
-            "\"assertionclientextensions\":\"eyJjaGFasdfasdffhs\"," .
-            "\"signaturedata\":\"MEUCIQDNrG...43hc\"}";
-
         $this->http->mock
             ->when()
             ->methodIs('POST')
             ->pathIs('/validate/check')
             ->then()
-            ->body(UtilsForTests::responseBodySuccess())
+            ->body(Utils::matchingOneTokenResponseBody())
             ->end();
         $this->http->setUp();
 
-        $response = $this->pi->validateCheckWebAuthn("testUser", "12345678", $webauthnSignResponse, "test.it");
+        $response = $this->pi->validateCheckWebAuthn("testUser", "12345678", Utils::webauthnSignResponse(), "test.it");
 
         $this->assertNotNull($response);
-        $this->assertEquals(UtilsForTests::responseBodySuccess(), $response->raw);
+        $this->assertEquals(Utils::matchingOneTokenResponseBody(), $response->raw);
         $this->assertEquals("matching 1 tokens", $response->message);
         $this->assertTrue($response->status);
         $this->assertTrue($response->value);
diff --git a/test/utils/Utils.php b/test/utils/Utils.php
new file mode 100644
index 0000000..a5d0e19
--- /dev/null
+++ b/test/utils/Utils.php
@@ -0,0 +1,287 @@
+<?php
+
+namespace utils;
+class Utils
+{
+    /**
+     * @return string
+     */
+    public static function authToken()
+    {
+        return "eyJ0eXAiOiJKV1Qi...NoBVmAurqcaaMAsD1S6chGIM";
+    }
+
+    /**
+     * @return string
+     */
+    public static function u2fSignRequest()
+    {
+        return "{\"appId\":\"https:\/\/ttype.u2f\"," .
+            "\"challenge\":\"TZKiB0VFFMFsnlz00lF5iCqtQduDJf56AeJAY_BT4NU\"," .
+            "\"keyHandle\":\"UUHmZ4BUFCrt7q88MhlQJYu4G5qB9l7ScjRRxA-M35cTH-uHWyMEpxs4WBzbkjlZqzZW1lC-jDdFd2pKDUsNnA\"," .
+            "\"version\":\"U2F_V2\"}";
+    }
+
+    /**
+     * @return string
+     */
+    public static function u2fSignResponse()
+    {
+        return "{\"clientData\":\"eyJjaGFsbGVuZ2UiOiJpY2UBc3NlcnRpb24ifQ\"," . "\"errorCode\":0," .
+            "\"keyHandle\":\"UUHmZ4BUFCrt7q88MhlQkjlZqzZW1lC-jDdFd2pKDUsNnA\"," .
+            "\"signatureData\":\"AQAAAxAwRQIgZwEObruoCRRo738F9up1tdV2M0H1MdP5pkO5Eg\"}";
+    }
+
+    /**
+     * @return string
+     */
+    public static function webauthnSignRequest()
+    {
+        return "{\n" . "            \"allowCredentials\": [\n" . "              {\n" .
+            "                \"id\": \"83De8z_CNqogB6aCyKs6dWIqwpOpzVoNaJ74lgcpuYN7l-95QsD3z-qqPADqsFlPwBXCMqEPssq75kqHCMQHDA\",\n" .
+            "                \"transports\": [\n" . "                  \"internal\",\n" .
+            "                  \"nfc\",\n" . "                  \"ble\",\n" .
+            "                  \"usb\"\n" . "                ],\n" .
+            "                \"type\": \"public-key\"\n" . "              }\n" .
+            "            ],\n" .
+            "            \"challenge\": \"dHzSmZnAhxEq0szRWMY4EGg8qgjeBhJDjAPYKWfd2IE\",\n" .
+            "            \"rpId\": \"office.netknights.it\",\n" .
+            "            \"timeout\": 60000,\n" .
+            "            \"userVerification\": \"preferred\"\n" . "          }\n";
+    }
+
+    /**
+     * @return string
+     */
+    public static function webauthnSignResponse()
+    {
+        return "{" . "\"credentialid\":\"X9FrwMfmzj...saw21\"," .
+            "\"authenticatordata\":\"xGzvgq0bVGR3WR0A...ZJdA7cBAAAACA\"," .
+            "\"clientdata\":\"eyJjaGFsbG...dfhs\"," .
+            "\"userhandle\":\"eyJjaGFsadffhs\"," .
+            "\"assertionclientextensions\":\"eyJjaGFasdfasdffhs\"," .
+            "\"signaturedata\":\"MEUCIQDNrG...43hc\"}";
+    }
+
+    /**
+     * @return string
+     */
+    public static function imageData()
+    {
+        return "data:image/png;base64,iVBdgfgsdfgRK5CYII=";
+    }
+
+    /**
+     * @return string
+     */
+    public static function matchingOneTokenResponseBody()
+    {
+        return "{\n" . "  \"detail\": {\n" . "    \"message\": \"matching 1 tokens\",\n" . "    \"otplen\": 6,\n" .
+            "    \"serial\": \"PISP0001C673\",\n" . "    \"threadid\": 140536383567616,\n" .
+            "    \"type\": \"totp\"\n" . "  },\n" . "  \"id\": 1,\n" . "  \"jsonrpc\": \"2.0\",\n" .
+            "  \"result\": {\n" . "    \"status\": true,\n" . "    \"value\": true\n" . "  },\n" .
+            "  \"time\": 1589276995.4397042,\n" . "  \"version\": \"privacyIDEA 3.2.1\",\n" .
+            "  \"versionnumber\": \"3.2.1\",\n" . "  \"signature\": \"rsa_sha256_pss:AAAAAAAAAAA\"\n" . "}";
+    }
+
+    /**
+     * @return string
+     */
+    public static function postAuthResponseBody()
+    {
+        return "{\n" . "    \"id\": 1,\n" . "    \"jsonrpc\": \"2.0\",\n" .
+            "    \"result\": {\n" . "        \"status\": true,\n" .
+            "        \"value\": {\n" . "            \"log_level\": 20,\n" .
+            "            \"menus\": [\n" . "                \"components\",\n" .
+            "                \"machines\"\n" . "            ],\n" .
+            "            \"realm\": \"\",\n" . "            \"rights\": [\n" .
+            "                \"policydelete\",\n" .
+            "                \"resync\"\n" . "            ],\n" .
+            "            \"role\": \"admin\",\n" . "            \"token\": \"" .
+            self::authToken() . "\",\n" . "            \"username\": \"admin\",\n" .
+            "            \"logout_time\": 120,\n" .
+            "            \"default_tokentype\": \"hotp\",\n" .
+            "            \"user_details\": false,\n" .
+            "            \"subscription_status\": 0\n" . "        }\n" .
+            "    },\n" . "    \"time\": 1589446794.8502703,\n" .
+            "    \"version\": \"privacyIDEA 3.2.1\",\n" .
+            "    \"versionnumber\": \"3.2.1\",\n" .
+            "    \"signature\": \"rsa_sha256_pss:\"\n" . "}";
+    }
+
+    /**
+     * @return string
+     */
+    public static function tokenInitResponseBody()
+    {
+        return "{\n" . "    \"detail\": {\n" . "        \"googleurl\": {\n" .
+            "            \"description\": \"URL for google Authenticator\",\n" .
+            "            \"img\": \"" . self::imageData() . "\",\n" .
+            "            \"value\": \"otpauth://hotp/OATH0003A0AA?secret=4DK5JEEQMWY3VES7EWB4M36TAW4YC2YH&counter=1&digits=6&issuer=privacyIDEA\"\n" .
+            "        },\n" . "        \"oathurl\": {\n" .
+            "            \"description\": \"URL for OATH token\",\n" .
+            "            \"img\": \"" . self::imageData() . "\",\n" .
+            "            \"value\": \"oathtoken:///addToken?name=OATH0003A0AA&lockdown=true&key=e0d5d4909065b1ba925f2583c66fd305b9816b07\"\n" .
+            "        },\n" . "        \"otpkey\": {\n" .
+            "            \"description\": \"OTP seed\",\n" .
+            "            \"img\": \"" . self::imageData() . "\",\n" .
+            "            \"value\": \"seed://e0d5d4909065b1ba925f2583c66fd305b9816b07\",\n" .
+            "            \"value_b32\": \"4DK5JEEQMWY3VES7EWB4M36TAW4YC2YH\"\n" .
+            "        },\n" . "        \"rollout_state\": \"\",\n" .
+            "        \"serial\": \"OATH0003A0AA\",\n" .
+            "        \"threadid\": 140470638720768\n" . "    },\n" .
+            "    \"id\": 1,\n" . "    \"jsonrpc\": \"2.0\",\n" .
+            "    \"result\": {\n" . "        \"status\": true,\n" .
+            "        \"value\": true\n" . "    },\n" .
+            "    \"time\": 1592834605.532012,\n" .
+            "    \"version\": \"privacyIDEA 3.3.3\",\n" .
+            "    \"versionnumber\": \"3.3.3\",\n" .
+            "    \"signature\": \"rsa_sha256_pss:\"\n" . "}";
+    }
+
+    /**
+     * @return string
+     */
+    public static function getTokenResponseBody()
+    {
+        return "{\"id\":1," . "\"jsonrpc\":\"2.0\"," . "\"result\":{" . "\"status\":true," . "\"value\":{" .
+            "\"count\":1," . "\"current\":1," . "\"tokens\":[{" . "\"active\":true," . "\"count\":2," .
+            "\"count_window\":10," . "\"description\":\"\"," . "\"failcount\":0," . "\"id\":347," .
+            "\"info\":{" . "\"count_auth\":\"1\"," . "\"count_auth_success\":\"1\"," .
+            "\"hashlib\":\"sha1\"," . "\"last_auth\":\"2022-03-2912:18:59.639421+02:00\"," .
+            "\"tokenkind\":\"software\"}," . "\"locked\":false," . "\"maxfail\":10," . "\"otplen\":6," .
+            "\"realms\":[\"defrealm\"]," . "\"resolver\":\"deflocal\"," . "\"revoked\":false," .
+            "\"rollout_state\":\"\"," . "\"serial\":\"OATH00123564\"," . "\"sync_window\":1000," .
+            "\"tokentype\":\"hotp\"," . "\"user_editable\":false," . "\"user_id\":\"5\"," .
+            "\"user_realm\":\"defrealm\"," . "\"username\":\"Test\"}]}}," . "\"time\":1648549489.57896," .
+            "\"version\":\"privacyIDEA3.6.3\"," . "\"versionnumber\":\"3.6.3\"," .
+            "\"signature\":\"rsa_sha256_pss:58c4eed1...5247c47e3e\"}";
+    }
+
+    /**
+     * @return string
+     */
+    public static function triggerPushTokenResponseBody()
+    {
+        return "{\n" . "  \"detail\": {\n" . "\"preferred_client_mode\":\"poll\"," . "    \"attributes\": null,\n" .
+            "    \"message\": \"Bitte geben Sie einen OTP-Wert ein: , Please confirm the authentication on your mobile device!\",\n" .
+            "    \"messages\": [\n" . "      \"Bitte geben Sie einen OTP-Wert ein: \",\n" .
+            "      \"Please confirm the authentication on your mobile device!\"\n" . "    ],\n" .
+            "    \"multi_challenge\": [\n" . "      {\n" . "        \"attributes\": null,\n" .
+            "        \"message\": \"Bitte geben Sie einen OTP-Wert ein: \",\n" .
+            "        \"serial\": \"OATH00020121\",\n" .
+            "        \"transaction_id\": \"02659936574063359702\",\n" . "        \"type\": \"hotp\"\n" .
+            "      },\n" . "      {\n" . "        \"attributes\": null,\n" .
+            "        \"message\": \"Please confirm the authentication on your mobile device!\",\n" .
+            "        \"serial\": \"PIPU0001F75E\",\n" .
+            "        \"transaction_id\": \"02659936574063359702\",\n" . "        \"type\": \"push\"\n" .
+            "      }\n" . "    ],\n" . "    \"serial\": \"PIPU0001F75E\",\n" .
+            "    \"threadid\": 140040525666048,\n" . "    \"transaction_id\": \"02659936574063359702\",\n" .
+            "    \"transaction_ids\": [\n" . "      \"02659936574063359702\",\n" .
+            "      \"02659936574063359702\"\n" . "    ],\n" . "    \"type\": \"push\"\n" . "  },\n" .
+            "  \"id\": 1,\n" . "  \"jsonrpc\": \"2.0\",\n" . "  \"result\": {\n" .
+            "    \"status\": true,\n" . "    \"value\": false\n" . "  },\n" .
+            "  \"time\": 1589360175.594304,\n" . "  \"version\": \"privacyIDEA 3.2.1\",\n" .
+            "  \"versionnumber\": \"3.2.1\",\n" . "  \"signature\": \"rsa_sha256_pss:AAAAAAAAAA\"\n" . "}";
+    }
+
+    /**
+     * @return string
+     */
+    public static function pollingResponseBody()
+    {
+        return '{
+                "id": 1,
+          "jsonrpc": "2.0",
+          "result": {
+                    "status": true,
+            "value": true
+          },
+          "version": "privacyIDEA 3.5.2",
+          "versionnumber": "3.5.2",
+          "signature": "rsa_sha256_pss:12345"
+        }';
+    }
+
+    /**
+     * @return string
+     */
+    public static function tcSuccessResponseBody()
+    {
+        return "{\"detail\":{" . "\"preferred_client_mode\":\"interactive\"," .
+            "\"image\": \"" . self::imageData() . "\",\n" .
+            "\"attributes\":null," . "\"message\":\"BittegebenSieeinenOTP-Wertein:\"," .
+            "\"messages\":[\"BittegebenSieeinenOTP-Wertein:\"]," . "\"multi_challenge\":[{" .
+            "\"attributes\":null," . "\"message\":\"BittegebenSieeinenOTP-Wertein:\"," .
+            "\"serial\":\"TOTP00021198\"," . "\"client_mode\":\"interactive\"," . "\"image\":\"" . self::imageData() . "\"," .
+            "\"transaction_id\":\"16734787285577957577\"," . "\"type\":\"totp\"}]," . "\"serial\":\"TOTP00021198\"," .
+            "\"threadid\":140050885818112," . "\"transaction_id\":\"16734787285577957577\"," .
+            "\"transaction_ids\":[\"16734787285577957577\"]," . "\"type\":\"totp\"}," . "\"id\":1," .
+            "\"jsonrpc\":\"2.0\"," . "\"result\":{" . "\"status\":true," . "\"value\":false}," .
+            "\"time\":1649666174.5351279," . "\"version\":\"privacyIDEA3.6.3\"," .
+            "\"versionnumber\":\"3.6.3\"," .
+            "\"signature\":\"rsa_sha256_pss:4b0f0e12c2...89409a2e65c87d27b\"}";
+    }
+
+    /**
+     * @return string
+     */
+    public static function errorUserNotFoundResponseBody()
+    {
+        return "{" . "\"detail\":null," . "\"id\":1," . "\"jsonrpc\":\"2.0\"," . "\"result\":{" . "\"error\":{" .
+            "\"code\":904," . "\"message\":\"ERR904: The user can not be found in any resolver in this realm!\"}," .
+            "\"status\":false}," . "\"time\":1649752303.65651," . "\"version\":\"privacyIDEA 3.6.3\"," .
+            "\"signature\":\"rsa_sha256_pss:1c64db29cad0dc127d6...5ec143ee52a7804ea1dc8e23ab2fc90ac0ac147c0\"}";
+    }
+
+    /**
+     * @return string
+     */
+    public static function triggerU2FResponseBody()
+    {
+        return "{" . "\"detail\":{" . "\"preferred_client_mode\":\"u2f\"," . "\"attributes\":{" . "\"hideResponseInput\":true," .
+            "\"image\":\"" . self::imageData() . "\"," . "\"u2fSignRequest\":{" .
+            "\"appId\":\"http//ttype.u2f\"," . "\"challenge\":\"TZKiB0VFFMF...tQduDJf56AeJAY_BT4NU\"," .
+            "\"keyHandle\":\"UUHmZ4BUFCrt7q88MhlQ...qzZW1lC-jDdFd2pKDUsNnA\"," .
+            "\"version\":\"U2F_V2\"}}," .
+            "\"message\":\"Please confirm with your U2F token (Yubico U2F EE Serial 61730834)\"," .
+            "\"messages\":[\"Please confirm with your U2F token (Yubico U2F EE Serial 61730834)\"]," .
+            "\"multi_challenge\":[{" . "\"attributes\":{" . "\"hideResponseInput\":true," .
+            "\"image\":\"" . self::imageData() . "\"," . "\"u2fSignRequest\":" .
+            self::u2fSignRequest() . "}," .
+            "\"message\":\"Please confirm with your U2F token (Yubico U2F EE Serial 61730834)\"," .
+            "\"serial\":\"U2F00014651\"," . "\"transaction_id\":\"12399202888279169736\"," .
+            "\"type\":\"u2f\"}]," . "\"serial\":\"U2F00014651\"," . "\"threadid\":140050978137856," .
+            "\"transaction_id\":\"12399202888279169736\"," .
+            "\"transaction_ids\":[\"12399202888279169736\"]," . "\"type\":\"u2f\"}," . "\"id\":1," .
+            "\"jsonrpc\":\"2.0\"," . "\"result\":{" . "\"status\":true," . "\"value\":false}," .
+            "\"time\":1649769348.7552881," . "\"version\":\"privacyIDEA 3.6.3\"," .
+            "\"versionnumber\":\"3.6.3\"," .
+            "\"signature\":\"rsa_sha256_pss:3e51d814...dccd5694b8c15943e37e1\"}";
+    }
+
+    /**
+     * @return string
+     */
+    public static function triggerWebauthnResponseBody()
+    {
+        return "{\n" . "  \"detail\": {\n" . "\"preferred_client_mode\":\"webauthn\"," . "    \"attributes\": {\n" . "      \"hideResponseInput\": true,\n" .
+            "      \"image\": \"" . self::imageData() . "\",\n" .
+            "      \"webAuthnSignRequest\": " . self::webauthnSignRequest() . "\n" . "    },\n" .
+            "    \"message\": \"Please confirm with your WebAuthn token (Yubico U2F EE Serial 61730834)\",\n" .
+            "    \"messages\": [\n" .
+            "      \"Please confirm with your WebAuthn token (Yubico U2F EE Serial 61730834)\"\n" . "    ],\n" .
+            "    \"multi_challenge\": [\n" . "      {\n" . "        \"attributes\": {\n" .
+            "          \"hideResponseInput\": true,\n" .
+            "          \"webAuthnSignRequest\": " . self::webauthnSignRequest() . "        },\n" .
+            "        \"message\": \"Please confirm with your WebAuthn token (Yubico U2F EE Serial 61730834)\",\n" .
+            "        \"serial\": \"WAN00025CE7\",\n" . "          \"image\": \"" . self::imageData() . "\",\n" .
+            "        \"transaction_id\": \"16786665691788289392\",\n" .
+            "        \"type\": \"webauthn\"\n" . "      }\n" . "    ],\n" . "    \"serial\": \"WAN00025CE7\",\n" .
+            "    \"threadid\": 140040275289856,\n" . "    \"transaction_id\": \"16786665691788289392\",\n" .
+            "    \"transaction_ids\": [\n" . "      \"16786665691788289392\"\n" . "    ],\n" .
+            "    \"type\": \"webauthn\"\n" . "  },\n" . "  \"id\": 1,\n" . "  \"jsonrpc\": \"2.0\",\n" .
+            "  \"result\": {\n" . "    \"authentication\": \"CHALLENGE\",\n" . "    \"status\": true,\n" .
+            "    \"value\": false\n" . "  },\n" . "  \"time\": 1611916339.8448942\n" . "}";
+    }
+}
\ No newline at end of file
diff --git a/test/utils/UtilsForTests.php b/test/utils/UtilsForTests.php
deleted file mode 100644
index 80d6771..0000000
--- a/test/utils/UtilsForTests.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-namespace utils;
-class UtilsForTests
-{
-    /**
-     * @return string
-     */
-    public static function responseBodySuccess()
-    {
-        return "{\n" . "  \"detail\": {\n" . "    \"message\": \"matching 1 tokens\",\n" . "    \"otplen\": 6,\n" .
-            "    \"serial\": \"PISP0001C673\",\n" . "    \"threadid\": 140536383567616,\n" .
-            "    \"type\": \"totp\"\n" . "  },\n" . "  \"id\": 1,\n" . "  \"jsonrpc\": \"2.0\",\n" .
-            "  \"result\": {\n" . "    \"status\": true,\n" . "    \"value\": true\n" . "  },\n" .
-            "  \"time\": 1589276995.4397042,\n" . "  \"version\": \"privacyIDEA 3.2.1\",\n" .
-            "  \"versionnumber\": \"3.2.1\",\n" . "  \"signature\": \"rsa_sha256_pss:AAAAAAAAAAA\"\n" . "}";
-    }
-
-    /**
-     * @param string $authToken
-     * @return string
-     */
-    public static function authToken($authToken)
-    {
-        return "{\n" . "    \"id\": 1,\n" . "    \"jsonrpc\": \"2.0\",\n" .
-            "    \"result\": {\n" . "        \"status\": true,\n" .
-            "        \"value\": {\n" . "            \"log_level\": 20,\n" .
-            "            \"menus\": [\n" . "                \"components\",\n" .
-            "                \"machines\"\n" . "            ],\n" .
-            "            \"realm\": \"\",\n" . "            \"rights\": [\n" .
-            "                \"policydelete\",\n" .
-            "                \"resync\"\n" . "            ],\n" .
-            "            \"role\": \"admin\",\n" . "            \"token\": \"" .
-            $authToken . "\",\n" . "            \"username\": \"admin\",\n" .
-            "            \"logout_time\": 120,\n" .
-            "            \"default_tokentype\": \"hotp\",\n" .
-            "            \"user_details\": false,\n" .
-            "            \"subscription_status\": 0\n" . "        }\n" .
-            "    },\n" . "    \"time\": 1589446794.8502703,\n" .
-            "    \"version\": \"privacyIDEA 3.2.1\",\n" .
-            "    \"versionnumber\": \"3.2.1\",\n" .
-            "    \"signature\": \"rsa_sha256_pss:\"\n" . "}";
-    }
-}
\ No newline at end of file
diff --git a/test/utils/phpunit.xml b/test/utils/phpunit.xml
index 6375023..a71844e 100644
--- a/test/utils/phpunit.xml
+++ b/test/utils/phpunit.xml
@@ -7,12 +7,17 @@
 		<report>
 			<html outputDirectory="./_coverage" lowUpperBound="35" highLowerBound="70"/>
 			<text outputFile="php://stdout" showUncoveredFiles="true"/>
-			<clover outputFile= "_coverage/clover.xml"/>
+			<clover outputFile="_coverage/clover.xml"/>
 		</report>
 	</coverage>
 	<testsuites>
 		<testsuite name="main">
-			<directory suffix="Test.php">../</directory>
+			<directory suffix="EnrollTokenTest.php">../</directory>
+			<directory suffix="PollTransactionTest.php">../</directory>
+			<directory suffix="TriggerChallengeTest.php">../</directory>
+			<directory suffix="ValidateCheckTest.php">../</directory>
+			<directory suffix="ValidateCheckU2FTest.php">../</directory>
+			<directory suffix="ValidateCheckWebauthnTest.php">../</directory>
 		</testsuite>
 	</testsuites>
 	<logging/>
-- 
GitLab