Open imjalpreet opened 8 years ago
@oparoz I am facing the following error: [InvalidArgumentException]
I'll take a look, but don't forget to enable the api suite in travis or it won't be able to test use your tests.
I'm not even getting that error. It stops at " [PHPUnit_Framework_Exception] getimagesize(): Read error!"
@oparoz I am not getting any error like that.
Also, can you explain how does the metadata get stored in database of these test images?
Also, can you explain how does the metadata get stored in database of these test images?
The same way it does when a user uploads images, the hook is triggered and the data extracted.
Looking at the image path, it's not an image path, it's a folder path, so that won't work. But it seems there is a bigger problem as the user tester doesn't seem to have any files in his account.
"app":"MediaMetadata","message":"Image Path: \/public_html\/data\/tester"
I have an idea of why it fails, give me a few minutes
OK, you'll need to also include the CheckTestUsersCest class. That's where users are actually created. We should improve that in the future, if possible.
Now I ran into another error, but you should be able to fix it:
[PHPUnit_Framework_Exception] array_key_exists() expects parameter 2 to be array, null given
That's in this method
//Date Created
if(array_key_exists('EXIFData', $metadata) && array_key_exists('dateCreated', $metadata['EXIFData'])) {
$imageDimension->setDateCreated($metadata['EXIFData']['dateCreated']);
}
In codeception.yml, you need to enable the test server.
See Gallery+ for the example.
I have enabled it but now it is giving an error in Travis.
@oparoz It is showing error in the .nomedia test file that we have used. What can be done regarding this?
Easy, you need to upload it ;)
Phew! Sorry. Uploaded it now.
@oparoz The error that is currently shown in Travis now is that Class(ImageDimension) cannot be redeclared in storeMetadata class, but it is necessary for that test to pass. How can that be corrected?
@oparoz Any idea from your side on how to resolve this issue?
I don't have that error. You route doesn't seem to work. Have you tested your API with a browser?
You don't have a route to the API
And you don't have the correct phpdoc set for your API controller
You need to understand how the PHPdoc system is working https://docs.nextcloud.com/server/10/developer_manual/app/controllers.html https://docs.nextcloud.com/server/10/developer_manual/app/api.html
@oparoz,
I don't have that error. You route doesn't seem to work. Have you tested your API with a browser?
Sorry, I forgot to test it with a browser while trying to write the tests.
But as you have pointed out that I don't have the route to API, I will add the route and update the PHPDoc and then test it in the browser.
@oparoz Will this route be correct for the API?
[
'name' => 'metadata_api#get_metadata',
'url' => '/api/metadata/{fileList}',
'verb' => 'GET'
],
Yes, but it's incomplete. Look at the API example in the doc.
@oparoz Okay, I will check and get back to you
@oparoz Are you talking about the requirements?
Also, what is wrong with the PHPDoc of the API controller?
Do I have to add @CORS
and @NoCSRFRequired
?
@oparoz I am getting this message when I am trying to test in the browser: {"message":"CORS requires basic auth"}
Also, what is wrong with the PHPDoc of the API controller? Do I have to add @CORS and @NoCSRFRequired?
I think the documentation is quite clear and you have a working example with Gallery+
Everything you need is on this page: https://docs.nextcloud.com/server/10/developer_manual/app/api.html
@oparoz,
I think the documentation is quite clear and you have a working example with Gallery+
Everything you need is on this page: https://docs.nextcloud.com/server/10/developer_manual/app/api.html
Do I have to modify any of the CORS header?
Do I have to modify any of the CORS header?
No, but you need to follow the rest of the instructions.
No, but you need to follow the rest of the instructions.
The PHPdoc on your method does not follow the guidelines
Sorry, I thought I followed them. I will look at it again.
Your routes file is missing the CORS entry
I will look into this also.
I will try to correct them and push the code soon
@oparoz I have looked at the Gallery App. I found out one thing:
Is this the CORS entry you were talking about?
'name' => 'author_api#preflighted_cors', 'url' => '/api/1.0/{path}', 'verb' => 'OPTIONS', 'requirements' => array('path' => '.+')
Also, if this is that , then do I have to include configcontroller or configapicontroller, which is the case with gallery?
Or I can add that route to metadata api?
Is this the CORS entry you were talking about?
Yes.
Make it match the URL in the 1st route you're going to use.
Did you manage to get it to work?
I am working on it. I will get back to you with the code by today evening. Actually, it got a little delayed due to some university assignments.
No worries. On the positive side, once fixed, the process works. Unfortunately, the data returned is wrong (0,0 for the size), so we'll still have to investigate why that happens
That's great. Once, I am able to fix it, I will look into the size issue.
@oparoz I am getting some errors in travis, can you check why?
Also, since yesterday, I am getting [InvalidArgumentException]
error when I am trying to run API tests on my system.
@oparoz I think I have written the correct URL but still its wrong somewhere. Can you check it?
@oparoz I am not getting the error in unit tests that is being displayed on travis. All the unit tests are passing on my system. And there hasn't been any change in the unit tests that they have started to fail now. Its surprising to me.
Yeah, I don't understand... I've now cleared the caches to see if it helps.
Make sure you pull my changes before adding new commits. But if it works on your setup now, then you can see the problem with the test. There is no metadata stored in the DB.
OK the failed tests are because of ownCloud master. We're targeting 9.1 for now and we'll see what to do once this works properly.
Okay.
@oparoz But now the error in API tests is that the JSON did not match. But I don't understand how it is getting the height and width as 100, 100 after extracting from the image whereas the size is 379, 300.
Well, it's 100 on Travis, but here it's 0, so there is something not working properly with the hook or the test setup
Any progress?
@oparoz I could not do much the last 3-4 days, as I had exams till today evening. I will give an update by tomorrow.
OK, take some rest and let's try to get this done early next week
@oparoz I am sorry for the delay. I will try to complete it soon.
Any news?
@oparoz I have written the code for the API test.
Can you please check it?