def test_execute_bug(self): bug = self.factory.makeBug() login_person(bug.owner) command = InformationTypeEmailCommand('informationtype', ['privatesecurity']) exec_bug, event = command.execute(bug, None) self.assertEqual(bug, exec_bug) self.assertEqual(InformationType.PRIVATESECURITY, bug.information_type) self.assertTrue(IObjectModifiedEvent.providedBy(event))
def test_execute_bug(self): bug = self.factory.makeBug() login_person(bug.owner) command = InformationTypeEmailCommand( 'informationtype', ['privatesecurity']) exec_bug, event = command.execute(bug, None) self.assertEqual(bug, exec_bug) self.assertEqual( InformationType.PRIVATESECURITY, bug.information_type) self.assertTrue(IObjectModifiedEvent.providedBy(event))
def test_execute_bug_params(self): user = self.factory.makePerson() login_person(user) bug_params = CreateBugParams(title='bug title', owner=user) command = InformationTypeEmailCommand('informationtype', ['publicsecurity']) dummy_event = object() params, event = command.execute(bug_params, dummy_event) self.assertEqual(bug_params, params) self.assertEqual(InformationType.PUBLICSECURITY, bug_params.information_type) self.assertTrue(IObjectModifiedEvent.providedBy(event))
def test_execute_bug_params(self): user = self.factory.makePerson() login_person(user) bug_params = CreateBugParams(title='bug title', owner=user) command = InformationTypeEmailCommand( 'informationtype', ['publicsecurity']) dummy_event = object() params, event = command.execute(bug_params, dummy_event) self.assertEqual(bug_params, params) self.assertEqual( InformationType.PUBLICSECURITY, bug_params.information_type) self.assertTrue(IObjectModifiedEvent.providedBy(event))
def test_execute_bug_params_with_rubbish(self): user = self.factory.makePerson() login_person(user) bug_params = CreateBugParams(title='bug title', owner=user) command = InformationTypeEmailCommand('informationtype', ['rubbish']) dummy_event = object() self.assertRaises(EmailProcessingError, command.execute, bug_params, dummy_event)