def test_format_email_body__new(self): """We generate an email body for new features.""" body_html = notifier.format_email_body(False, self.feature_1, []) self.assertIn('Blink', body_html) self.assertIn('[email protected] added', body_html) self.assertIn( 'www.chromestatus.com/feature/%d' % self.feature_1.key().id(), body_html) self.assertNotIn('watcher_1,', body_html)
def test_format_email_body__update_with_changes(self): """We generate an email body for an updated feature.""" body_html = notifier.format_email_body(True, self.feature_1, self.changes) self.assertIn('test_prop', body_html) self.assertIn( 'www.chromestatus.com/feature/%d' % self.feature_1.key().id(), body_html) self.assertIn('test old value', body_html) self.assertIn('test new value', body_html)
def test_format_email_body__update_with_changes(self, mock_wf_content): """We generate an email body for an updated feature.""" mock_wf_content.return_value = 'mock_wf_content' changes = [dict(prop_name='test_prop', new_val='test new value', old_val='test old value')] body_html = notifier.format_email_body( True, self.feature_1, self.component_1, changes) self.assertIn('test_prop', body_html) self.assertIn('test old value', body_html) self.assertIn('test new value', body_html)
def test_format_email_body__new(self, mock_wf_content): """We generate an email body for new features.""" mock_wf_content.return_value = 'mock_wf_content' body_html = notifier.format_email_body( False, self.feature_1, self.component_1, []) self.assertIn('Blink', body_html) self.assertIn('Hi <b>owner_1</b>,', body_html) self.assertIn('[email protected] added', body_html) self.assertNotIn('watcher_1,', body_html) mock_wf_content.assert_called_once_with('Blink')
def test_format_email_body__update_no_changes(self, mock_wf_content): """We don't crash if the change list is emtpy.""" mock_wf_content.return_value = 'mock_wf_content' body_html = notifier.format_email_body( True, self.feature_1, self.component_1, []) self.assertIn('Blink', body_html) self.assertIn('[email protected] updated', body_html) self.assertIn('Hi <b>owner_1</b>,', body_html) self.assertNotIn('watcher_1,', body_html) self.assertIn('mock_wf_content', body_html) mock_wf_content.assert_called_once_with('Blink')
def test_format_email_body__update_no_changes(self): """We don't crash if the change list is emtpy.""" body_html = notifier.format_email_body(True, self.feature_1, []) self.assertIn('Blink', body_html) self.assertIn('[email protected] updated', body_html) self.assertNotIn('watcher_1,', body_html)