Пример #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)
Пример #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)
Пример #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')
Пример #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)
Пример #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")
Пример #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)
Пример #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')
Пример #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")
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)