From 52884a7692aa077d9979320c732b3630c27a4084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Jaussoin?= Date: Tue, 25 Jan 2022 14:50:23 +0100 Subject: [PATCH] Fix the serialized account type in the vCard 4.0 Fix the tests Fix the default type in AccountFactory --- flexiapi/app/Account.php | 2 +- flexiapi/database/factories/AccountFactory.php | 2 +- flexiapi/tests/Feature/AccountContactsTest.php | 16 +++++++--------- flexisip-account-manager.spec | 2 +- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/flexiapi/app/Account.php b/flexiapi/app/Account.php index 618b96f..9c6a011 100644 --- a/flexiapi/app/Account.php +++ b/flexiapi/app/Account.php @@ -272,7 +272,7 @@ X-LINPHONE-ACCOUNT-DTMF-PROTOCOL:'.$this->dtmf_protocol; foreach ($this->types as $type) { $vcard .= ' -X-LINPHONE-ACCOUNT-TYPE:'.$type; +X-LINPHONE-ACCOUNT-TYPE:'.$type->key; } foreach ($this->actions as $action) { diff --git a/flexiapi/database/factories/AccountFactory.php b/flexiapi/database/factories/AccountFactory.php index 694d52f..493d850 100644 --- a/flexiapi/database/factories/AccountFactory.php +++ b/flexiapi/database/factories/AccountFactory.php @@ -38,7 +38,7 @@ class AccountFactory extends Factory 'confirmation_key' => Str::random(WebAuthenticateController::$emailCodeSize), 'ip_address' => $this->faker->ipv4, 'creation_time' => $this->faker->dateTime, - 'dtmf_protocol' => Account::$dtmfProtocols[array_rand(Account::$dtmfProtocols)], + 'dtmf_protocol' => array_rand(Account::$dtmfProtocols), 'activated' => true ]; } diff --git a/flexiapi/tests/Feature/AccountContactsTest.php b/flexiapi/tests/Feature/AccountContactsTest.php index 0085b24..2236588 100644 --- a/flexiapi/tests/Feature/AccountContactsTest.php +++ b/flexiapi/tests/Feature/AccountContactsTest.php @@ -44,7 +44,6 @@ class AccountContactTest extends TestCase $typeKey = 'phone'; $actionKey = '123'; $actionCode = '123'; - $actionProtocol = 'sipinfo'; $admin = Admin::factory()->create(); $admin->account->generateApiKey(); @@ -78,8 +77,7 @@ class AccountContactTest extends TestCase $this->keyAuthenticated($admin->account) ->json($this->method, $this->route.'/'.$password2->account->id.'/actions', [ 'key' => $actionKey, - 'code' => $actionCode, - 'protocol' => $actionProtocol + 'code' => $actionCode ]); // Retry @@ -120,16 +118,16 @@ class AccountContactTest extends TestCase $this->keyAuthenticated($password1->account) ->get('/contacts/vcard') ->assertStatus(200) - ->assertSeeText($typeKey) - ->assertSeeText($password2->dtmf_protocol) - ->assertSeeText($actionKey.';'.$actionCode); + ->assertSeeText("X-LINPHONE-ACCOUNT-TYPE:".$typeKey) + ->assertSeeText("X-LINPHONE-ACCOUNT-DTMF-PROTOCOL:".$password2->dtmf_protocol) + ->assertSeeText("X-LINPHONE-ACCOUNT-ACTION:".$actionKey.';'.$actionCode); $this->keyAuthenticated($password1->account) ->get('/contacts/vcard/'.$password2->account->identifier) ->assertStatus(200) - ->assertSeeText($typeKey) - ->assertSeeText($password2->dtmf_protocol) - ->assertSeeText($actionKey.';'.$actionCode); + ->assertSeeText("X-LINPHONE-ACCOUNT-TYPE:".$typeKey) + ->assertSeeText("X-LINPHONE-ACCOUNT-DTMF-PROTOCOL:".$password2->dtmf_protocol) + ->assertSeeText("X-LINPHONE-ACCOUNT-ACTION:".$actionKey.';'.$actionCode); $this->keyAuthenticated($password1->account) ->get($this->route.'/me/contacts/'.$password2->account->identifier) diff --git a/flexisip-account-manager.spec b/flexisip-account-manager.spec index be3c43a..ba4487c 100644 --- a/flexisip-account-manager.spec +++ b/flexisip-account-manager.spec @@ -8,7 +8,7 @@ #%define _datadir %{_datarootdir} #%define _docdir %{_datadir}/doc -%define build_number 126 +%define build_number 127 %define var_dir /var/opt/belledonne-communications %define opt_dir /opt/belledonne-communications/share/flexisip-account-manager