mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-27 16:08:55 +02:00
Fixes spec on guzzle adapter
This commit is contained in:
@@ -6,6 +6,7 @@ use PhpSpec\ObjectBehavior;
|
||||
use Prophecy\Argument;
|
||||
use GuzzleHttp\Client;
|
||||
use InfluxDB\Options;
|
||||
use GuzzleHttp\Message\Response;
|
||||
|
||||
class GuzzleAdapterSpec extends ObjectBehavior
|
||||
{
|
||||
@@ -34,13 +35,30 @@ class GuzzleAdapterSpec extends ObjectBehavior
|
||||
|
||||
function it_should_query_data(Client $client, Options $options)
|
||||
{
|
||||
$client->get("select * from tcp.test", [])->willReturn([]);
|
||||
$this->query("select * from tcp.test")->shouldReturn([]);
|
||||
$client->get(
|
||||
"localhost",
|
||||
[
|
||||
"auth" => ["one", "two"],
|
||||
"query" => [
|
||||
"q" => "select * from tcp.test",
|
||||
]
|
||||
]
|
||||
)->willReturn(new Response(200,[],null));
|
||||
$this->query("select * from tcp.test")->shouldReturn(null);
|
||||
}
|
||||
|
||||
function it_should_query_data_with_time_precision(Client $client, Options $options)
|
||||
{
|
||||
$client->get("select * from tcp.test", ["time_precision" => "s"])->willReturn([]);
|
||||
$this->query("select * from tcp.test", "s")->shouldReturn([]);
|
||||
$client->get(
|
||||
"localhost",
|
||||
[
|
||||
"auth" => ["one", "two"],
|
||||
"query" => [
|
||||
"time_precision" => "s",
|
||||
"q" => "select * from tcp.test",
|
||||
]
|
||||
]
|
||||
)->willReturn(new Response(200, [], null));
|
||||
$this->query("select * from tcp.test", "s")->shouldReturn(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,10 +55,9 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$this->object->mark("tcp.test", ["mark" => "element"]);
|
||||
|
||||
$cursor = $this->anotherClient->getDatabase($this->options->getDatabase())
|
||||
->query("select * from tcp.test");
|
||||
$this->assertCount(1, $cursor);
|
||||
$this->assertEquals("element", $cursor[0]->mark);
|
||||
$body = $this->object->query("select * from tcp.test");
|
||||
$this->assertCount(1, $body[0]["points"]);
|
||||
$this->assertEquals("element", $body[0]["points"][0][2]);
|
||||
}
|
||||
|
||||
public function testGuzzleHttpQueryApiWorksCorrectly()
|
||||
|
||||
Reference in New Issue
Block a user