Re: [google-appengine] Testbed unit tests for blobstore file upload API

2015-03-05 Thread Baire Adams
Alex,

Thanks for your response to Remko!

I am facing a similar issue as Remko.  I happily came across your post and 
followed the link to stackoverflow.  When researching a bit more, it seems 
the blobstore file API is being deprecated...

Is there no better (read long term) way of doing this than the 
stackoverflow post suggests?  Probably I am missing something here.

Regards,
Baire


On Wednesday, March 4, 2015 at 5:01:50 PM UTC+1, Alex Martelli wrote:
>
> Hi Remko,
>
> technical questions like yours are better sent to Stack Overflow -- the 
> groups are for discussions that would not be welcome on stackoverflow.com 
> per their FAQ.
>
> In this case you're probably able to use the solution already posted at 
> http://stackoverflow.com/questions/8130063/test-function-with-google-app-engine-files-api
> so it's probably best not to post your Q there (it would be a duplicate).
>
> If that solution doesn't work, however, then a new stackoverflow Q is 
> indeed appropriate
> (specifically referring to that other Q and explaining what problems 
> remain after using the
> approach in that Q's accepted and vastly-upvoted answer).  We sponsor and 
> monitor
> (among others) the google-app-engine tag on stackoverflow and will do our 
> best to help there, if the existing solution does not meet your very 
> sensible requirements.
>
> `testbed` is unfortunately rather undocumented (sorry!) but that's a 
> longer-term issue for us to fix... not something you should wait for!
>
>
> Alex
>
>
> On Wed, Mar 4, 2015 at 2:01 AM, > wrote:
>
>> Hi, 
>>
>> I'm trying to write a unit test for file uploads in my (Python) API.
>> I'm using the using the blobstore API to create an upload URL, as follows:
>> self.response.write(blobstore.create_upload_url())
>>
>> Everything works fine in production, but when using Testbed, I get the 
>> following URL back:
>> 
>> http://testbed.example.com/_ah/upload/agx0ZXN0YmVkLXRlc3RyGwsSFV9fQmxvYlVwbG9hZFNlc3Npb25fXxgDDA
>>
>> Uploading to this URL from the test doesn't work, I get a 404. I should 
>> have initialized all stubs properly, amongst others:
>> self.testbed.init_datastore_v3_stub()
>> self.testbed.init_blobstore_stub()
>> self.testbed.init_files_stub()
>>
>> What am I doing wrong? How do I unit test file uploads?
>>
>> thanks,
>> Remko
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Google App Engine" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to google-appengi...@googlegroups.com .
>> To post to this group, send email to google-a...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/google-appengine.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/google-appengine/4bc5a934-20f9-419a-a990-fa923c5a53b6%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/9a2020a0-4dbf-4f1f-a71c-09c2a531cfc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [google-appengine] Testbed unit tests for blobstore file upload API

2015-03-04 Thread 'Alex Martelli' via Google App Engine
Hi Remko,

technical questions like yours are better sent to Stack Overflow -- the
groups are for discussions that would not be welcome on stackoverflow.com
per their FAQ.

In this case you're probably able to use the solution already posted at
http://stackoverflow.com/questions/8130063/test-function-with-google-app-engine-files-api
so it's probably best not to post your Q there (it would be a duplicate).

If that solution doesn't work, however, then a new stackoverflow Q is
indeed appropriate
(specifically referring to that other Q and explaining what problems remain
after using the
approach in that Q's accepted and vastly-upvoted answer).  We sponsor and
monitor
(among others) the google-app-engine tag on stackoverflow and will do our
best to help there, if the existing solution does not meet your very
sensible requirements.

`testbed` is unfortunately rather undocumented (sorry!) but that's a
longer-term issue for us to fix... not something you should wait for!


Alex


On Wed, Mar 4, 2015 at 2:01 AM,  wrote:

> Hi,
>
> I'm trying to write a unit test for file uploads in my (Python) API.
> I'm using the using the blobstore API to create an upload URL, as follows:
> self.response.write(blobstore.create_upload_url())
>
> Everything works fine in production, but when using Testbed, I get the
> following URL back:
>
> http://testbed.example.com/_ah/upload/agx0ZXN0YmVkLXRlc3RyGwsSFV9fQmxvYlVwbG9hZFNlc3Npb25fXxgDDA
>
> Uploading to this URL from the test doesn't work, I get a 404. I should
> have initialized all stubs properly, amongst others:
> self.testbed.init_datastore_v3_stub()
> self.testbed.init_blobstore_stub()
> self.testbed.init_files_stub()
>
> What am I doing wrong? How do I unit test file uploads?
>
> thanks,
> Remko
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-appengine+unsubscr...@googlegroups.com.
> To post to this group, send email to google-appengine@googlegroups.com.
> Visit this group at http://groups.google.com/group/google-appengine.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-appengine/4bc5a934-20f9-419a-a990-fa923c5a53b6%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/CAE46Be_9_Sm%2B9RDMnRfF_ajuiOrU9q4haXWk87i_dA58zuFb8A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[google-appengine] Testbed unit tests for blobstore file upload API

2015-03-04 Thread remko
Hi, 

I'm trying to write a unit test for file uploads in my (Python) API.
I'm using the using the blobstore API to create an upload URL, as follows:
self.response.write(blobstore.create_upload_url())

Everything works fine in production, but when using Testbed, I get the 
following URL back:

http://testbed.example.com/_ah/upload/agx0ZXN0YmVkLXRlc3RyGwsSFV9fQmxvYlVwbG9hZFNlc3Npb25fXxgDDA

Uploading to this URL from the test doesn't work, I get a 404. I should 
have initialized all stubs properly, amongst others:
self.testbed.init_datastore_v3_stub()
self.testbed.init_blobstore_stub()
self.testbed.init_files_stub()

What am I doing wrong? How do I unit test file uploads?

thanks,
Remko

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/4bc5a934-20f9-419a-a990-fa923c5a53b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.