def test_apply_stage_outgoing_validation_rule(self): doc = {'id': '1', 'body_html': 'Test-1'} update = {'headline': 'x'} stage = {'outgoing_macro': 'take_key_validator'} with self.app.app_context(): with assert_raises(SuperdeskApiError): apply_stage_rule(doc, update, stage, is_incoming=False)
def test_apply_outgoing_stage_rule(self): doc = {'id': '1', 'body_html': 'Test-1'} update = {'anpa_take_key': 'x'} stage = {'outgoing_macro': 'populate_abstract'} with self.app.app_context(): apply_stage_rule(doc, update, stage, is_incoming=False) self.assertEquals(update['abstract'], 'Test-1')
def test_apply_on_stage_validation_rule(self): doc = {'id': '1', 'body_html': 'Test-1'} update = {'headline': 'x'} stage = {'onstage_macro': 'take_key_validator'} with self.app.app_context(): with assert_raises(SuperdeskApiError): apply_stage_rule(doc, update, stage, MACRO_ONSTAGE)
def test_apply_outgoing_stage_rule(self): doc = {"id": "1", "body_html": "Test-1"} update = {"anpa_take_key": "x"} stage = {"outgoing_macro": "populate_abstract"} with self.app.app_context(): apply_stage_rule(doc, update, stage, MACRO_OUTGOING) self.assertEquals(update["abstract"], "Test-1")
def test_apply_stage_outgoing_validation_rule(self): doc = {"id": "1", "body_html": "Test-1"} update = {"headline": "x"} stage = {"outgoing_macro": "take_key_validator"} with self.app.app_context(): with assert_raises(SuperdeskApiError): apply_stage_rule(doc, update, stage, MACRO_OUTGOING)
def test_apply_outgoing_stage_rule(self): doc = {"id": "1", "body_html": "Test-1"} update = {"anpa_take_key": "x"} stage = {"outgoing_macro": "populate_abstract"} with self.app.app_context(): apply_stage_rule(doc, update, stage, is_incoming=False) self.assertEquals(update["abstract"], "Test-1")
def test_apply_stage_outgoing_validation_rule(self): doc = {"id": "1", "body_html": "Test-1"} update = {"headline": "x"} stage = {"outgoing_macro": "take_key_validator"} with self.app.app_context(): with assert_raises(SuperdeskApiError): apply_stage_rule(doc, update, stage, is_incoming=False)
def test_apply_stage_outgoing_validation_rule_ignored(self): doc = {'id': '1', 'body_html': 'Test-1'} update = {'headline': 'x'} stage = {'incoming_macro': 'take_key_validator'} with self.app.app_context(): apply_stage_rule(doc, update, stage, is_incoming=False)
def test_apply_stage_incoming_validation_rule_passes(self): doc = {'id': '1', 'body_html': 'Test-1', 'anpa_take_key': 'a'} update = {'headline': 'x'} stage = {'incoming_macro': 'take_key_validator'} with self.app.app_context(): apply_stage_rule(doc, update, stage, is_incoming=True)
def test_apply_stage_outgoing_validation_rule_ignored(self): doc = {"id": "1", "body_html": "Test-1"} update = {"headline": "x"} stage = {"incoming_macro": "take_key_validator"} with self.app.app_context(): apply_stage_rule(doc, update, stage, MACRO_OUTGOING)
def test_apply_stage_incoming_validation_rule_passes(self): doc = {"id": "1", "body_html": "Test-1", "anpa_take_key": "a"} update = {"headline": "x"} stage = {"incoming_macro": "take_key_validator"} with self.app.app_context(): apply_stage_rule(doc, update, stage, MACRO_INCOMING)
def test_apply_stage_outgoing_validation_rule_ignored(self): doc = {"id": "1", "body_html": "Test-1"} update = {"headline": "x"} stage = {"incoming_macro": "take_key_validator"} with self.app.app_context(): apply_stage_rule(doc, update, stage, is_incoming=False)
def test_apply_stage_incoming_validation_rule_passes(self): doc = {"id": "1", "body_html": "Test-1", "anpa_take_key": "a"} update = {"headline": "x"} stage = {"incoming_macro": "take_key_validator"} with self.app.app_context(): apply_stage_rule(doc, update, stage, is_incoming=True)