Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dbp-relay-blob-bundle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
digital blueprint
Relay API Gateway
dbp-relay-blob-bundle
Commits
01ea251e
Commit
01ea251e
authored
2 years ago
by
Neuber, Eugen Ramon
Browse files
Options
Downloads
Patches
Plain Diff
Fix updating existing file data with mock.
parent
a0bf9b61
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/DataProvider/FileDataDataProvider.php
+5
-3
5 additions, 3 deletions
src/DataProvider/FileDataDataProvider.php
tests/CurlGetTest.php
+12
-4
12 additions, 4 deletions
tests/CurlGetTest.php
with
17 additions
and
7 deletions
src/DataProvider/FileDataDataProvider.php
+
5
−
3
View file @
01ea251e
...
...
@@ -79,6 +79,7 @@ class FileDataDataProvider extends AbstractDataProvider
$fileData
=
$this
->
blobService
->
setBucket
(
$fileData
);
if
(
$this
->
requestStack
->
getCurrentRequest
()
->
getMethod
()
!==
'DELETE'
)
{
// create shareLink
$fileData
=
$this
->
blobService
->
getLink
(
$fileData
);
$this
->
blobService
->
saveFileData
(
$fileData
);
}
...
...
@@ -118,12 +119,13 @@ class FileDataDataProvider extends AbstractDataProvider
$fileDatas
=
$this
->
blobService
->
getFileDataByBucketIDAndPrefixWithPagination
(
$bucketId
,
$prefix
,
$currentPageNumber
,
$maxNumItemsPerPage
);
assertNotNull
(
$this
->
blobService
,
'blob service not initialized'
);
// create sharelinks
foreach
(
$fileDatas
as
$fileData
)
{
foreach
(
$fileDatas
as
&
$fileData
)
{
assert
(
$fileData
instanceof
FileData
);
$fileData
->
setBucket
(
$bucket
);
$fileData
=
$this
->
blobService
->
getLink
(
$fileData
);
//
$this->blobService->saveFileData($fileData);
$this
->
blobService
->
saveFileData
(
$fileData
);
}
return
$fileDatas
;
...
...
This diff is collapsed.
Click to expand it.
tests/CurlGetTest.php
+
12
−
4
View file @
01ea251e
...
...
@@ -52,6 +52,9 @@ class DummyFileSystemService implements DatasystemProviderServiceInterface
return
null
;
}
$fileData
->
setContentUrl
(
"https://localhost.lan/link/
$identifier
"
);
self
::
$fd
[
$identifier
]
=
$fileData
;
return
self
::
$fd
[
$identifier
];
}
...
...
@@ -117,7 +120,7 @@ class CurlGetTest extends ApiTestCase
}
/**
* Integration test for get all for a prefix with empty result
* Integration test for get all for a prefix with empty result
.
*/
public
function
testGet
():
void
{
...
...
@@ -574,7 +577,7 @@ class CurlGetTest extends ApiTestCase
}
/**
* Integration test: get all with expired token creation time
* Integration test: get all with expired token creation time
.
*/
public
function
testGetExpired
():
void
{
...
...
@@ -582,6 +585,11 @@ class CurlGetTest extends ApiTestCase
$client
=
static
::
createClient
();
$configService
=
$client
->
getContainer
()
->
get
(
ConfigurationService
::
class
);
// =======================================================
// GET a file with expired token
// =======================================================
echo
"GET a file with expired token
\n
"
;
$bucket
=
$configService
->
getBuckets
()[
0
];
$secret
=
$bucket
->
getPublicKey
();
$bucketId
=
$bucket
->
getIdentifier
();
...
...
@@ -620,7 +628,7 @@ class CurlGetTest extends ApiTestCase
/**
* Integration test: get and delete blob with unknown id
* Integration test: get and delete blob with unknown id
.
*/
public
function
testGetDeleteByUnknownId
():
void
{
...
...
@@ -661,7 +669,7 @@ class CurlGetTest extends ApiTestCase
$client
->
getKernelBrowser
()
->
followRedirects
();
/** @var Response $response */
$response
=
$client
->
request
(
'GET'
,
"
$url
/
{
$uuid
}
"
,
$options
);
$response
=
$client
->
request
(
'GET'
,
$url
,
$options
);
$this
->
assertEquals
(
404
,
$response
->
getStatusCode
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment