コード例 #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
ファイル: tasks_tests.py プロジェクト: ancafarcas/superdesk
 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
ファイル: tasks_tests.py プロジェクト: ancafarcas/superdesk
 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
ファイル: tasks_tests.py プロジェクト: lnogues/superdesk-core
 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
ファイル: tasks_tests.py プロジェクト: Flowdeeps/superdesk-1
 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
ファイル: tasks_tests.py プロジェクト: Flowdeeps/superdesk-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)
コード例 #10
0
ファイル: tasks_tests.py プロジェクト: ancafarcas/superdesk
 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
ファイル: tasks_tests.py プロジェクト: ancafarcas/superdesk
 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
ファイル: tasks_tests.py プロジェクト: Flowdeeps/superdesk-1
 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
ファイル: tasks_tests.py プロジェクト: Flowdeeps/superdesk-1
 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)