예제 #1
0
 def test_edit_description(self):
     """
     The description should be editable.
     When sending data, the 'edit' keyword should be set to 'description'.
     """
     desc = "Lorem ipsum"
     data = {"title": self.project.title, "description": desc, "tags": ""}
     form = forms.ProjectUpdateForm(data, instance=self.project)
     ok_(form.is_valid(), "The form should validate. %s" % form.errors)
     http_post_response(self.url, self.view, data, self.contributor, **self.kwargs)
     self.project.refresh_from_db()
     eq_(self.project.description, desc, "The description should be updated.")
예제 #2
0
 def test_add_contributors(self, mock_notify):
     """When adding contributors, each new contributor should get an email notification."""
     new_contributor = factories.UserFactory()
     data = {
         'title': self.project.title,
         'contributors': [self.contributor.pk, new_contributor.pk]
     }
     form = forms.ProjectUpdateForm(data, instance=self.project)
     ok_(form.is_valid(), 'The form should validate. %s' % form.errors)
     http_post_response(self.url, self.view, data, self.contributor,
                        **self.kwargs)
     self.project.refresh_from_db()
     ok_(self.project.has_contributor(new_contributor))
     ok_(self.project.has_contributor(self.contributor))
     mock_notify.assert_called_once_with(new_contributor, self.project,
                                         self.contributor)