Esempio 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)
Esempio 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)
Esempio 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')
Esempio 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)
Esempio 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")
Esempio 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)
Esempio 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')
Esempio 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")
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)