Fix the serialized account type in the vCard 4.0

Fix the tests
Fix the default type in AccountFactory
This commit is contained in:
Timothée Jaussoin 2022-01-25 14:50:23 +01:00
parent f3ffa96ea6
commit 52884a7692
4 changed files with 10 additions and 12 deletions

View file

@ -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) {

View file

@ -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
];
}

View file

@ -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)

View file

@ -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