Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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')
Ejemplo n.º 4
0
 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)
Ejemplo n.º 5
0
 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")
Ejemplo n.º 6
0
 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)
Ejemplo n.º 7
0
 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')
Ejemplo n.º 8
0
 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")
Ejemplo n.º 9
0
 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)
Ejemplo n.º 10
0
 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)
Ejemplo n.º 11
0
 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)
Ejemplo n.º 12
0
 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)
Ejemplo n.º 13
0
 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)
Ejemplo n.º 14
0
 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)
Ejemplo n.º 15
0
 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)
Ejemplo n.º 16
0
 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)
Ejemplo n.º 17
0
 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)