Merge lp:~rvb/maas/empty-files-1.2 into lp:maas/1.2

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 1378
Proposed branch: lp:~rvb/maas/empty-files-1.2
Merge into: lp:maas/1.2
Diff against target: 33 lines (+12/-1)
2 files modified
src/maasserver/models/filestorage.py (+1/-1)
src/maasserver/tests/test_api.py (+11/-0)
To merge this branch: bzr merge lp:~rvb/maas/empty-files-1.2
Reviewer Review Type Date Requested Status
Raphaël Badin (community) Approve
Review via email: mp+176975@code.launchpad.net

Commit message

Backport of revision 1540.

To post a comment you must log in.
Revision history for this message
Raphaël Badin (rvb) :
review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

No commit message specified.

Revision history for this message
Julian Edwards (julian-edwards) wrote :

On 26/07/13 01:40, Raphaël Badin wrote:
> The proposal to merge lp:~rvb/maas/empty-files-1.2 into lp:maas/1.2 has been updated.
>
> Commit Message changed to:
>
> Backport of revision 1540.
>

Please please please don't use commit messages like this. The first
part is ok, but I also want to see what the backport is for without
looking up revision 1540 in trunk (assuming that's where it came from -
it doesn't say).

The best format to use for backports is:
Backport of <branch> rNNNN: <commit msg from other branch>

Thanks!

Revision history for this message
Raphaël Badin (rvb) wrote :

All right.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/models/filestorage.py'
2--- src/maasserver/models/filestorage.py 2013-02-25 15:49:49 +0000
3+++ src/maasserver/models/filestorage.py 2013-07-25 15:30:45 +0000
4@@ -83,7 +83,7 @@
5 unique_together = ('filename', 'owner')
6
7 filename = CharField(max_length=255, unique=False, editable=False)
8- content = BinaryField(null=False)
9+ content = BinaryField(null=False, blank=True)
10 # owner can be None: this is to support upgrading existing
11 # installations where the files were not linked to users yet.
12 owner = ForeignKey(
13
14=== modified file 'src/maasserver/tests/test_api.py'
15--- src/maasserver/tests/test_api.py 2013-04-25 07:56:53 +0000
16+++ src/maasserver/tests/test_api.py 2013-07-25 15:30:45 +0000
17@@ -2804,6 +2804,17 @@
18 self.assertIn('text/plain', response['Content-Type'])
19 self.assertEqual("Filename not supplied", response.content)
20
21+ def test_add_empty_file(self):
22+ filename = "filename"
23+ response = self.make_API_POST_request(
24+ "add", filename=filename,
25+ fileObj=factory.make_file_upload(content=b''))
26+ self.assertEqual(httplib.CREATED, response.status_code)
27+ self.assertItemsEqual(
28+ [filename],
29+ FileStorage.objects.filter(
30+ filename=filename).values_list('filename', flat=True))
31+
32 def test_add_file_fails_with_no_file_attached(self):
33 response = self.make_API_POST_request("add", "foo")
34

Subscribers

People subscribed via source and target branches

to status/vote changes: