|
16 | 16 | use Aternos\HangarApi\Client\Project; |
17 | 17 | use Aternos\HangarApi\Client\User; |
18 | 18 | use Aternos\HangarApi\Client\Version; |
19 | | -use Aternos\HangarApi\Configuration; |
20 | 19 | use Aternos\HangarApi\Model\Category; |
21 | 20 | use Aternos\HangarApi\Model\Platform; |
22 | 21 | use Aternos\HangarApi\Model\ProjectMember; |
@@ -58,37 +57,15 @@ public function testDefaultUserAgentIsSentWithRequests(): void |
58 | 57 | /** |
59 | 58 | * @throws ApiException |
60 | 59 | */ |
61 | | - public function testConfigurationFromConstructorIsUsed(): void |
| 60 | + public function testUserAgentFromConstructorReplacesDefaultUserAgent(): void |
62 | 61 | { |
63 | | - $configuration = new Configuration() |
64 | | - ->setHost("https://hangar.example.com") |
65 | | - ->setUserAgent("test-agent/1.0"); |
66 | | - $client = $this->createClient([new Response(200, [], "1.0.0")], configuration: $configuration); |
| 62 | + $client = $this->createClient([new Response(200, [], "1.0.0")], "test-agent/1.0"); |
67 | 63 |
|
68 | 64 | $client->getLatestReleaseVersion("mclogs"); |
69 | 65 |
|
70 | | - $this->assertEquals("hangar.example.com", $this->getRequest()->getUri()->getHost()); |
71 | 66 | $this->assertEquals("test-agent/1.0", $this->getRequest()->getHeaderLine("User-Agent")); |
72 | 67 | } |
73 | 68 |
|
74 | | - /** |
75 | | - * @throws ApiException |
76 | | - */ |
77 | | - public function testApiKeyFromConstructorIsUsedForAuthentication(): void |
78 | | - { |
79 | | - $client = $this->createClient([ |
80 | | - new Response(200, [], json_encode(["token" => "test-jwt", "expiresIn" => 3600])), |
81 | | - new Response(200, [], "1.0.0"), |
82 | | - ], "test-api-key"); |
83 | | - |
84 | | - $client->getLatestReleaseVersion("mclogs"); |
85 | | - |
86 | | - $this->assertEquals("POST", $this->getRequest(0)->getMethod()); |
87 | | - $this->assertEquals("/api/v1/authenticate", $this->getRequest(0)->getUri()->getPath()); |
88 | | - $this->assertEquals(["apiKey" => "test-api-key"], $this->getQuery(0)); |
89 | | - $this->assertEquals("Bearer test-jwt", $this->getRequest(1)->getHeaderLine("Authorization")); |
90 | | - } |
91 | | - |
92 | 69 | /** |
93 | 70 | * @throws ApiException |
94 | 71 | */ |
|
0 commit comments