Adam Johnson schrieb am Donnerstag, 18. Februar 2021 um 10:04:01 UTC+1:

> Hi
>
> If you're mocking away the storage class to speed up your tests, instead 
> try this in-memory storage class which implements the complete API:  
> https://github.com/waveaccounting/dj-inmemorystorage . Then you don't 
> need any mocks.
>
>
Thank you for this hint.
 

> As to adding the shortcut - if the only thing it will help with is your 
> test length, why not write a couple of wrapper functions in your tests? 
>

It is about easier usage for storing strings/bytes and easier testing  (if 
you store strings/bytes).

Of course I can write a wrapper, but I have several django projects. I 
could create a library which exists of one method with one line.
But why not make life easier for all people?
 

> I'm not sure we'd want to add this capability to Django since it would 
> complicate the type signature and would enforce change on all the third 
> party storage classes that exist.
>

I don't only few Storage Implementation override save(), they override 
_save():

example: 
https://github.com/waveaccounting/dj-inmemorystorage/blob/master/inmemorystorage/storage.py#L193


 

>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/45ba5be0-4580-4e7f-823b-50c77c84f91en%40googlegroups.com.
  • Fea... guettli
    • ... 'Adam Johnson' via Django developers (Contributions to Django itself)
      • ... Mariusz Felisiak
      • ... guettli

Reply via email to