def test_basic(self): sample_email = os.path.join(settings.ROOT, 'mkt', 'comm', 'tests', 'emails', 'email.txt') req = self.get_request(data={'body': open(sample_email).read()}) app = app_factory() user = user_factory() self.grant_permission(user, 'Admin:*') t = CommunicationThread.objects.create(_addon=app, _version=app.current_version) t.token.create(user=user, uuid='5a0b8a83d501412589cc5d562334b46b') res = post_email(req) eq_(res.status_code, 201) ok_(t.notes.count())
def test_bad_request(self): """Test with no email body.""" res = post_email(self.get_request()) eq_(res.status_code, 400)
def test_successful(self, _mock): req = self.get_request({'body': 'something'}) res = post_email(req) _mock.assert_called_with(('something',)) eq_(res.status_code, 201)
def test_successful(self, _mock): req = self.get_request({'body': 'something'}) res = post_email(req) _mock.assert_called_with(('something', )) eq_(res.status_code, 201)