This repository has been archived by the owner on May 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from kachar/qr_code_request
Added QR code request to authy api client
- Loading branch information
Showing
2 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -240,6 +240,28 @@ public function testPhonceCallWithValidUser() | |
$this->assertRegExp('/Call started/i', $call->message()); | ||
} | ||
|
||
public function testQrCodeWithInvalidUser() | ||
{ | ||
$mock_client = $this->mockClient([[404, '{"errors": {"message": "User not found."}}']]); | ||
$call = $mock_client->qrCode(0, []); | ||
|
||
$this->assertEquals(false, $call->ok()); | ||
$this->assertEquals("User not found.", $call->errors()->message); | ||
} | ||
|
||
public function testQrCodeWithValidUser() | ||
{ | ||
$mock_client = $this->mockClient([ | ||
[200, '{ "user": { "id": 2 } }'], | ||
[200, '{ "qr_code": "https://example.com/qr.png" }'] | ||
]); | ||
$user = $mock_client->registerUser('[email protected]', '305-456-2345', 1); | ||
$call = $mock_client->qrCode($user->id(), []); | ||
|
||
$this->assertEquals(true, $call->ok()); | ||
$this->assertNotNull($call->bodyvar('qr_code')); | ||
} | ||
|
||
public function testDeleteUserWithInvalidUser() | ||
{ | ||
$mock_client = $this->mockClient([[404, '{"errors": {"message": "User not found."}}']]); | ||
|