Opened 14 years ago

Last modified 13 years ago

#80 closed defect (FIXED)

Test submission views

Reported by: Christopher Allan Webber Owned by: Christopher Allan Webber
Priority: minor Milestone: 0.0.4
Component: programming Keywords:
Cc: Parent Tickets:

Description

Submission views, also untested, time to test them!



Change History (17)

comment:1 by Christopher Allan Webber, 14 years ago

Owner: changed from Christopher Webber to Chris Moylan
Chris Moylan,

You did such a stellar job on the authentication tests I wonder if
you want to / are interested in working on this. Assigning to you
for now. If you don't want to do it or would rather work on
something else, let me know, otherwise I think this would come out
well from you!

There are a few things to consider in here, such as what happens
when things go badly in the submission process? (Actually, we're
only testing in this view whether or not the filename is wrong,
etc, so you don't need to worry about that.) Ping me on IRC and we
can talk about it if things are confusing.



comment:2 by Chris Moylan, 14 years ago

I was looking at this ticket earlier. Seems easy enough. Are we
testing the actual upload process in addition to form submission?



comment:3 by Chris Moylan, 14 years ago

Status: NewIn Progress

comment:3 by Christopher Allan Webber, 14 years ago

We should test the upload process as in terms of "does this file
hit the queue\_store and is it registered as such in the database".
We don't need to test the "processing" step that gets handed off to
celery.

Thanks so much for working on this!



comment:4 by Chris Moylan, 13 years ago

I've fallen a little behind on this because I had a busy weekend
and I started a Minecraft server. I think I've wrapped my head
around testing file uploads in Nose so this should come together
fairly quickly now.



comment:5 by Christopher Allan Webber, 13 years ago

Good to know... thanks for the update. If you get stuck, ping me on
IRC.



comment:6 by Elrond, 13 years ago

Milestone: 0.0.30.0.4
Meeting result



comment:7 by Chris Moylan, 13 years ago

I think I've got a good start.
[https://gitorious.org/\ :sub:`cmoylan/mediagoblin/cmoylan-mediagoblin/commits/test\_submission\_views\_365](https://gitorious.org/`\ cmoylan/mediagoblin/cmoylan-mediagoblin/commits/test\_submission\_views\_365)

All tests pass except for the malicious files with .jpg and .png
extensions. When I try to upload my malicious files I get an
internal server error. The malicious files I'm using are just
copies of the 'ls' binary with .jpg and .png extensions.

Could use a quick dev review.



comment:8 by Christopher Allan Webber, 13 years ago

So this looks good to me! A few requests then it's mergable:


-  Instead of doing things with getcwd(), could you instead use
   pkg\_resources? It's not hard, here's how to do it:

   GOOD\_JPG = pkg\_resources.resource\_filename( 'mediagoblin.tests',
   'test\_submission/good.jpg')


This uses the actual python packaging to do things.


-  Don't worry about the submitting bad filenames with the same
   extension because I think we need to complete
   `http://bugs.foocorp.net/issues/324 <http://bugs.foocorp.net/issues/324>`_
   before we can do anything about that :( ... (I also think in the
   future these errors in will be caught in the processing stage) your
   tests look good though, for now please comment them out instead of
   removing them with a reference to us not handling this right.
-  We've switched it so you redirect to the user's homepage
   post-successful-submission... accomodate that. (We should probably
   test for a message inserted into the messaging framework but
   there's no way to do that... for now just check that we go to the
   user's homepage.)

Looking good... thanks so much for this!



comment:9 by Chris Moylan, 13 years ago

Excellent. I will implement the changes and report back. Thanks for
the feedback!



comment:10 by Christopher Allan Webber, 13 years ago

Horray! Looking forward to it :)



comment:11 by Chris Moylan, 13 years ago

[https://gitorious.org/\ :sub:`cmoylan/mediagoblin/cmoylan-mediagoblin/commits/test\_submission\_views\_365](https://gitorious.org/`\ cmoylan/mediagoblin/cmoylan-mediagoblin/commits/test\_submission\_views\_365)


-  Switched to pkg\_resources
-  Asserted redirect to user page after upload
-  Commented out "invalid file with valid extension" tests

Requesting pull.



comment:12 by Chris Moylan, 13 years ago

Owner: changed from Chris Moylan to Christopher Webber
Status: In ProgressResolved
-  Merging in master again to keep the branch up to date
-  Assigning to cwebber so it's on your radar



comment:13 by Christopher Allan Webber, 13 years ago

Thanks Chris Moylan,

I'm working on getting the migrations stuff merged, then I'll try
to tackle this next. Erk!



comment:14 by Christopher Allan Webber, 13 years ago

Status: ResolvedFeedback

comment:14 by Christopher Allan Webber, 13 years ago

Status: FeedbackClosed
Merged at last! Thanks so much!



comment:15 by Will Kahn-Greene, 13 years ago

The original url for this bug was http://bugs.foocorp.net/issues/365 .
Relations:
#23: blocked

Note: See TracTickets for help on using tickets.