Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub issue/164 #165

Merged
merged 2 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ ELASTIC_AUTH=ember-nexus-elasticsearch:9200
REDIS_AUTH=tcp://ember-nexus-redis?password=redis-password
RABBITMQ_AUTH=amqp://user:password@ember-nexus-rabbitmq:5672

REFERENCE_DATASET_VERSION=0.0.12
REFERENCE_DATASET_VERSION=0.0.13
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Rename term "session" to "token", closes #145.
- Finalise documentation for the POST /token endpoint, closes #49.
- Implement changes from #161.
### Fixed
- Fix id and link properties in parents, children and related endpoints are wrong, closes #164.

## 0.0.32 - 2023-09-30
### Added
Expand Down
2 changes: 1 addition & 1 deletion docs/api-endpoints/user/get-me/200-response-body.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"email": "[email protected]",
"note": "User contains password only due to testing purposes.",
"password": "1234",
"test": "general.anonymousUser"
"scenario": "general.anonymousUser"
}
}
6 changes: 3 additions & 3 deletions docs/api-endpoints/user/get-token/200-response-body.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"type": "Token",
"id": "2f8e245a-ff14-4f3c-b2c9-b8f7a61e55d6",
"data": {
"created": "2023-10-06T17:22:31+00:00",
"updated": "2023-10-06T17:22:31+00:00",
"created": "2023-10-06T21:16:27+00:00",
"updated": "2023-10-06T21:16:27+00:00",
"note": "Token contains token only due to testing purposes.",
"test": "endpoint.user.getToken"
"scenario": "endpoint.user.getToken"
}
}
1 change: 0 additions & 1 deletion src/Command/DatabaseDropCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ private function deleteObjectStorage(): void
{
$this->io->startSection('Task 3 of 6: Object Storage');
$this->io->writeln('Deleting object storage data...');
// todo
$this->io->stopSection('Object storage is currently not implemented, nothing to delete.');
}

Expand Down
2 changes: 1 addition & 1 deletion src/Service/CollectionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function getPageLink(int $page = null): string
if (null === $currentRequest) {
throw $this->server500LogicExceptionFactory->createFromTemplate('Current request can not be null.');
}
$basePath = $currentRequest->getBasePath();
$basePath = $currentRequest->getPathInfo();

if ('' === $basePath) {
$basePath = '/';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function testChangePasswordSuccess(): void
'currentPassword' => '1234',
'newPassword' => 'abcd',
'data' => [
'email' => '[email protected].de',
'email' => '[email protected].dev',
],
]
);
Expand All @@ -41,7 +41,7 @@ public function testChangePasswordError400(): void
'currentPassword' => '1234',
'newPassword' => 'abcd',
'data' => [
'email' => '[email protected].de',
'email' => '[email protected].dev',
],
]
);
Expand Down
2 changes: 1 addition & 1 deletion tests/ExampleGenerationController/User/PostTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class PostTokenTest extends BaseRequestTestCase
{
public const EMAIL = '[email protected].de';
public const EMAIL = '[email protected].dev';
public const PASSWORD = '1234';
private const PATH_TO_ROOT = __DIR__.'/../../../';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function testCreateNode(): void
'type' => 'Data',
'data' => [
'name' => 'some name',
'test' => 'e1-01',
'scenario' => 'e1-01',
],
]
);
Expand All @@ -32,7 +32,7 @@ public function testCreateNodeWithoutType(): void
[
'data' => [
'name' => 'some name',
'test' => 'e1-01',
'scenario' => 'e1-01',
],
]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testCreateRelation(): void
'type' => 'RELATION',
'data' => [
'name' => 'some name',
'test' => 'e1-02',
'scenario' => 'e1-02',
],
'start' => self::START,
'end' => self::END,
Expand All @@ -36,7 +36,7 @@ public function testCreateRelationWithoutType(): void
[
'data' => [
'name' => 'some name',
'test' => 'e1-02',
'scenario' => 'e1-02',
],
'start' => self::START,
'end' => self::END,
Expand All @@ -54,7 +54,7 @@ public function testCreateRelationWithoutStart(): void
'type' => 'RELATION',
'data' => [
'name' => 'some name',
'test' => 'e1-02',
'scenario' => 'e1-02',
],
'end' => self::END,
]
Expand All @@ -71,7 +71,7 @@ public function testCreateRelationWithoutEnd(): void
'type' => 'RELATION',
'data' => [
'name' => 'some name',
'test' => 'e1-02',
'scenario' => 'e1-02',
],
'start' => self::START,
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function testPutNode(): void
$response = $this->runGetRequest(sprintf('/%s', self::DATA), self::TOKEN);
$this->assertIsNodeResponse($response, 'Data');
$data = $this->getBody($response)['data'];
$this->assertArrayHasKey('test', $data);
$this->assertArrayHasKey('scenario', $data);
$this->assertArrayHasKey('name', $data);
$this->assertArrayHasKey('created', $data);
$this->assertArrayHasKey('updated', $data);
Expand All @@ -25,7 +25,7 @@ public function testPutNode(): void
self::TOKEN,
[
'new-property' => 'new value',
'test' => 'e3-01',
'scenario' => 'e3-01',
]
);
print_r((string) $response->getBody());
Expand All @@ -34,7 +34,7 @@ public function testPutNode(): void
$response = $this->runGetRequest(sprintf('/%s', self::DATA), self::TOKEN);
$this->assertIsNodeResponse($response, 'Data');
$data = $this->getBody($response)['data'];
$this->assertArrayHasKey('test', $data);
$this->assertArrayHasKey('scenario', $data);
$this->assertArrayHasKey('created', $data);
$this->assertArrayHasKey('new-property', $data);
$this->assertArrayHasKey('updated', $data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function testPutRelation(): void
$response = $this->runGetRequest(sprintf('/%s', self::RELATION), self::TOKEN);
$this->assertIsRelationResponse($response, 'RELATION');
$data = $this->getBody($response)['data'];
$this->assertArrayHasKey('test', $data);
$this->assertArrayHasKey('scenario', $data);
$this->assertArrayHasKey('name', $data);
$this->assertArrayHasKey('created', $data);
$this->assertArrayHasKey('updated', $data);
Expand All @@ -25,15 +25,15 @@ public function testPutRelation(): void
self::TOKEN,
[
'new-property' => 'new value',
'test' => 'e3-02',
'scenario' => 'e3-02',
]
);
$this->assertNoContentResponse($response);

$response = $this->runGetRequest(sprintf('/%s', self::RELATION), self::TOKEN);
$this->assertIsRelationResponse($response, 'RELATION');
$data = $this->getBody($response)['data'];
$this->assertArrayHasKey('test', $data);
$this->assertArrayHasKey('scenario', $data);
$this->assertArrayHasKey('created', $data);
$this->assertArrayHasKey('new-property', $data);
$this->assertArrayHasKey('updated', $data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function testPutNode(): void
$response = $this->runGetRequest(sprintf('/%s', self::DATA), self::TOKEN);
$this->assertIsNodeResponse($response, 'Data');
$data = $this->getBody($response)['data'];
$this->assertArrayHasKey('test', $data);
$this->assertArrayHasKey('scenario', $data);
$this->assertArrayHasKey('name', $data);
$this->assertArrayHasKey('created', $data);
$this->assertArrayHasKey('updated', $data);
Expand All @@ -32,7 +32,7 @@ public function testPutNode(): void
$response = $this->runGetRequest(sprintf('/%s', self::DATA), self::TOKEN);
$this->assertIsNodeResponse($response, 'Data');
$data = $this->getBody($response)['data'];
$this->assertArrayHasKey('test', $data);
$this->assertArrayHasKey('scenario', $data);
$this->assertArrayHasKey('created', $data);
$this->assertArrayHasKey('new-property', $data);
$this->assertArrayHasKey('updated', $data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function testPutRelation(): void
$response = $this->runGetRequest(sprintf('/%s', self::RELATION), self::TOKEN);
$this->assertIsRelationResponse($response, 'RELATION');
$data = $this->getBody($response)['data'];
$this->assertArrayHasKey('test', $data);
$this->assertArrayHasKey('scenario', $data);
$this->assertArrayHasKey('created', $data);
$this->assertArrayHasKey('updated', $data);
$this->assertArrayHasNoNullValues($data);
Expand All @@ -31,7 +31,7 @@ public function testPutRelation(): void
$response = $this->runGetRequest(sprintf('/%s', self::RELATION), self::TOKEN);
$this->assertIsRelationResponse($response, 'RELATION');
$data = $this->getBody($response)['data'];
$this->assertArrayHasKey('test', $data);
$this->assertArrayHasKey('scenario', $data);
$this->assertArrayHasKey('created', $data);
$this->assertArrayHasKey('new-property', $data);
$this->assertArrayHasKey('updated', $data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class PostChangePasswordTest extends BaseRequestTestCase
{
public const EMAIL = '[email protected].de';
public const EMAIL = '[email protected].dev';
public const PASSWORD = '1234';
public const NEW_PASSWORD = 'abcd';

Expand Down
12 changes: 6 additions & 6 deletions tests/FeatureTests/Endpoint/User/PostRegisterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function testPostRegister(): void
'type' => 'User',
'password' => '1234',
'data' => [
'email' => '[email protected].de',
'email' => '[email protected].dev',
],
]
);
Expand All @@ -31,7 +31,7 @@ public function testPostRegisterWithoutType(): void
[
'password' => '1234',
'data' => [
'email' => '[email protected].de',
'email' => '[email protected].dev',
],
]
);
Expand All @@ -48,7 +48,7 @@ public function testPostRegisterWithWrongType(): void
'type' => 'NotAUser',
'password' => '1234',
'data' => [
'email' => '[email protected].de',
'email' => '[email protected].dev',
],
]
);
Expand All @@ -64,7 +64,7 @@ public function testPostRegisterWithNoPassword(): void
[
'type' => 'User',
'data' => [
'email' => '[email protected].de',
'email' => '[email protected].dev',
],
]
);
Expand Down Expand Up @@ -97,7 +97,7 @@ public function testPostRegisterFailsForDuplicateEmail(): void
'type' => 'User',
'password' => '1234',
'data' => [
'email' => '[email protected].de',
'email' => '[email protected].dev',
],
]
);
Expand All @@ -111,7 +111,7 @@ public function testPostRegisterFailsForDuplicateEmail(): void
'type' => 'User',
'password' => '1234',
'data' => [
'email' => '[email protected].de',
'email' => '[email protected].dev',
],
]
);
Expand Down
2 changes: 1 addition & 1 deletion tests/FeatureTests/Endpoint/User/PostTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class PostTokenTest extends BaseRequestTestCase
{
public const TOKEN = 'secret-token:3tgEP9MhD81rkp3qiJcm1U';
public const EMAIL = '[email protected].de';
public const EMAIL = '[email protected].dev';
public const PASSWORD = '1234';

public function testPostToken(): void
Expand Down
10 changes: 5 additions & 5 deletions tests/FeatureTests/General/Pagination/ChildrenPaginationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ public function testParentWithManyChildrenPagination(): void

$data = json_decode((string) $response->getBody(), true);
$this->assertSame(62, $data['totalNodes']);
$this->assertSame('/', $data['links']['first']);
$this->assertSame('/1ab54e88-a9cc-481a-b371-8873ca56c51b/children', $data['links']['first']);
$this->assertSame(null, $data['links']['previous']);
$this->assertSame('/?page=2', $data['links']['next']);
$this->assertSame('/?page=3', $data['links']['last']);
$this->assertSame('/1ab54e88-a9cc-481a-b371-8873ca56c51b/children?page=2', $data['links']['next']);
$this->assertSame('/1ab54e88-a9cc-481a-b371-8873ca56c51b/children?page=3', $data['links']['last']);
$this->assertCount(25, $data['nodes']);
$this->assertCount(25, $data['relations']);
}
Expand All @@ -44,10 +44,10 @@ public function testParentWithOneChildPagination(): void

$data = json_decode((string) $response->getBody(), true);
$this->assertSame(1, $data['totalNodes']);
$this->assertSame('/', $data['links']['first']);
$this->assertSame('/12ac1946-0efd-43b2-8e8f-fc73a2413b03/children', $data['links']['first']);
$this->assertSame(null, $data['links']['previous']);
$this->assertSame(null, $data['links']['next']);
$this->assertSame('/', $data['links']['last']);
$this->assertSame('/12ac1946-0efd-43b2-8e8f-fc73a2413b03/children', $data['links']['last']);
$this->assertCount(1, $data['nodes']);
$this->assertCount(1, $data['relations']);
}
Expand Down
10 changes: 5 additions & 5 deletions tests/FeatureTests/General/Pagination/ParentsPaginationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ public function testChildWithManyParentsPagination(): void

$data = json_decode((string) $response->getBody(), true);
$this->assertSame(62, $data['totalNodes']);
$this->assertSame('/', $data['links']['first']);
$this->assertSame('/27ebaf04-8bd0-4c8b-9fce-c44f8f63312e/parents', $data['links']['first']);
$this->assertSame(null, $data['links']['previous']);
$this->assertSame('/?page=2', $data['links']['next']);
$this->assertSame('/?page=3', $data['links']['last']);
$this->assertSame('/27ebaf04-8bd0-4c8b-9fce-c44f8f63312e/parents?page=2', $data['links']['next']);
$this->assertSame('/27ebaf04-8bd0-4c8b-9fce-c44f8f63312e/parents?page=3', $data['links']['last']);
$this->assertCount(25, $data['nodes']);
$this->assertCount(25, $data['relations']);
}
Expand All @@ -44,10 +44,10 @@ public function testChildWithOneParentPagination(): void

$data = json_decode((string) $response->getBody(), true);
$this->assertSame(1, $data['totalNodes']);
$this->assertSame('/', $data['links']['first']);
$this->assertSame('/9b3f66d3-0078-472e-9c38-3cf7499a242a/parents', $data['links']['first']);
$this->assertSame(null, $data['links']['previous']);
$this->assertSame(null, $data['links']['next']);
$this->assertSame('/', $data['links']['last']);
$this->assertSame('/9b3f66d3-0078-472e-9c38-3cf7499a242a/parents', $data['links']['last']);
$this->assertCount(1, $data['nodes']);
$this->assertCount(1, $data['relations']);
}
Expand Down
10 changes: 5 additions & 5 deletions tests/FeatureTests/General/Pagination/RelatedPaginationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ public function testNodeWithManyRelatedElements(): void

$data = json_decode((string) $response->getBody(), true);
$this->assertSame(63, $data['totalNodes']);
$this->assertSame('/', $data['links']['first']);
$this->assertSame('/1ab54e88-a9cc-481a-b371-8873ca56c51b/related', $data['links']['first']);
$this->assertSame(null, $data['links']['previous']);
$this->assertSame('/?page=2', $data['links']['next']);
$this->assertSame('/?page=3', $data['links']['last']);
$this->assertSame('/1ab54e88-a9cc-481a-b371-8873ca56c51b/related?page=2', $data['links']['next']);
$this->assertSame('/1ab54e88-a9cc-481a-b371-8873ca56c51b/related?page=3', $data['links']['last']);
$this->assertCount(25, $data['nodes']);
$this->assertCount(25, $data['relations']);
}
Expand All @@ -44,10 +44,10 @@ public function testNodeWithTwoRelatedElements(): void

$data = json_decode((string) $response->getBody(), true);
$this->assertSame(2, $data['totalNodes']);
$this->assertSame('/', $data['links']['first']);
$this->assertSame('/f461a898-36d6-48a3-98a8-0df163d87104/related', $data['links']['first']);
$this->assertSame(null, $data['links']['previous']);
$this->assertSame(null, $data['links']['next']);
$this->assertSame('/', $data['links']['last']);
$this->assertSame('/f461a898-36d6-48a3-98a8-0df163d87104/related', $data['links']['last']);
$this->assertCount(2, $data['nodes']);
$this->assertCount(2, $data['relations']);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function test2010305(): void
'type' => 'Data',
'data' => [
'name' => 'I shall exist.',
'test' => '2-01',
'scenario' => '2-01',
],
]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private function baseSearchTest(string $token): void
[
'query' => [
'term' => [
'test.keyword' => 'security.limitedAccess.searchAccess',
'scenario.keyword' => 'security.limitedAccess.searchAccess',
],
],
'nodeTypes' => ['Data'],
Expand Down
Loading