Exemplo n.º 1
0
    def test_photo_modified(self, update_mock):
        dummy = Mock()
        dummy.user = self.user

        data = {"username": self.user_profile.username, "email": self.user_profile.email}
        files = {"photo": get_uploaded_file("transparent.png")}
        form = UserEditForm(data, files=files, instance=self.user_profile, request=dummy)
        assert form.is_valid()
        form.save()
        assert update_mock.called
Exemplo n.º 2
0
    def test_photo_modified(self, update_mock):
        dummy = Mock()
        dummy.user = self.user

        data = {'username': self.user_profile.username,
                'email': self.user_profile.email}
        files = {'photo': get_uploaded_file('transparent.png')}
        form = UserEditForm(data, files=files, instance=self.user_profile,
                            request=dummy)
        assert form.is_valid()
        form.save()
        assert update_mock.called
Exemplo n.º 3
0
    def test_photo_modified(self, update_mock):
        dummy = Mock()
        dummy.user = self.user

        data = {'username': self.user_profile.username,
                'email': self.user_profile.email,
                'lang': 'en-US'}
        files = {'photo': get_uploaded_file('transparent.png')}
        form = UserEditForm(data, files=files, instance=self.user_profile,
                            request=dummy)
        assert form.is_valid()
        form.save()
        assert update_mock.called
Exemplo n.º 4
0
 def test_icon(self, update_mock):
     collection = Collection.objects.get(pk=57181)
     # TODO(andym): altering this form is too complicated, can we simplify?
     form = forms.CollectionForm(
                     {'listed': collection.listed,
                      'slug': collection.slug,
                      'name': collection.name},
                     instance=collection,
                     files={'icon': get_uploaded_file('transparent.png')},
                     initial={'author': collection.author,
                              'application_id': collection.application.pk})
     assert form.is_valid()
     form.save()
     assert update_mock.called
Exemplo n.º 5
0
 def test_icon(self, update_mock):
     collection = Collection.objects.get(pk=57181)
     # TODO(andym): altering this form is too complicated, can we simplify?
     form = forms.CollectionForm(
                     {'listed': collection.listed,
                      'slug': collection.slug,
                      'name': collection.name},
                     instance=collection,
                     files={'icon': get_uploaded_file('transparent.png')},
                     initial={'author': collection.author,
                              'application_id': collection.application.pk})
     assert form.is_valid()
     form.save()
     assert update_mock.called
Exemplo n.º 6
0
 def test_icon(self, update_mock):
     collection = Collection.objects.get(pk=57181)
     # TODO(andym): altering this form is too complicated, can we simplify?
     form = forms.CollectionForm(
                     {'listed': collection.listed,
                      'slug': collection.slug,
                      'name': collection.name},
                     instance=collection,
                     files={'icon': get_uploaded_file('transparent.png')},
                     initial={'author': collection.author,
                              'application_id': collection.application.pk})
     dest = (path.path(settings.COLLECTIONS_ICON_PATH) / 'uploads' /
                       'collection_icons' / '57')
     if not os.path.exists(dest):
         os.makedirs(dest)
     assert form.is_valid()
     form.save()
     assert update_mock.called
Exemplo n.º 7
0
 def test_icon(self, update_mock):
     collection = Collection.objects.get(pk=57181)
     # TODO(andym): altering this form is too complicated, can we simplify?
     form = forms.CollectionForm(
                     {'listed': collection.listed,
                      'slug': collection.slug,
                      'name': collection.name},
                     instance=collection,
                     files={'icon': get_uploaded_file('transparent.png')},
                     initial={'author': collection.author,
                              'application_id': collection.application.pk})
     dest = (path.path(settings.COLLECTIONS_ICON_PATH) / 'uploads' /
                       'collection_icons' / '57')
     if not os.path.exists(dest):
         os.makedirs(dest)
     assert form.is_valid()
     form.save()
     assert update_mock.called