コード例 #1
0
ファイル: test_alert.py プロジェクト: tomjelinek/pcs
 def test_one_recipient(self):
     self.config.env.push_cib(
         remove="./configuration/alerts/alert/recipient[@id='alert-recip1']"
     )
     cmd_alert.remove_recipient(
         self.env_assist.get_env(),
         ["alert-recip1"]
     )
コード例 #2
0
ファイル: test_alert.py プロジェクト: visioncritical/pcs
 def test_one_recipient(self):
     self.config.env.push_cib(
         remove="./configuration/alerts/alert/recipient[@id='alert-recip1']"
     )
     cmd_alert.remove_recipient(
         self.env_assist.get_env(),
         ["alert-recip1"]
     )
コード例 #3
0
ファイル: test_alert.py プロジェクト: miladalipour99/pcs
 def test_multiple_recipients(self):
     self.config.env.push_cib(remove=[
         "./configuration/alerts/alert/recipient[@id='alert-recip1']",
         "./configuration/alerts/alert/recipient[@id='alert-recip2']",
         "./configuration/alerts/alert/recipient[@id='alert2-recip4']",
     ])
     cmd_alert.remove_recipient(
         self.env_assist.get_env(),
         ["alert-recip1", "alert-recip2", "alert2-recip4"])
コード例 #4
0
ファイル: test_alert.py プロジェクト: tomjelinek/pcs
 def test_multiple_recipients(self):
     self.config.env.push_cib(
         remove=[
             "./configuration/alerts/alert/recipient[@id='alert-recip1']",
             "./configuration/alerts/alert/recipient[@id='alert-recip2']",
             "./configuration/alerts/alert/recipient[@id='alert2-recip4']",
         ]
     )
     cmd_alert.remove_recipient(
         self.env_assist.get_env(),
         ["alert-recip1", "alert-recip2", "alert2-recip4"]
     )
コード例 #5
0
 def test_success(self):
     cmd_alert.remove_recipient(self.mock_env, "alert-recipient")
     assert_xml_equal(
         """
         <cib validate-with="pacemaker-2.5">
             <configuration>
                 <alerts>
                     <alert id="alert" path="path">
                         <recipient id="alert-recipient-1" value="value"/>
                     </alert>
                 </alerts>
             </configuration>
         </cib>
         """, self.mock_env._get_cib_xml())
コード例 #6
0
 def test_recipient_not_found(self):
     self.env_assist.assert_raise_library_error(
         lambda: cmd_alert.remove_recipient(
             self.env_assist.get_env(),
             ["recipient", "alert-recip1", "alert2-recip1"],
         ))
     self.env_assist.assert_reports([
         (
             Severities.ERROR,
             report_codes.ID_NOT_FOUND,
             {
                 "id": "recipient",
                 "expected_types": ["recipient"],
                 "context_type": "alerts",
                 "context_id": "",
             },
             None,
         ),
         (
             Severities.ERROR,
             report_codes.ID_NOT_FOUND,
             {
                 "id": "alert2-recip1",
                 "expected_types": ["recipient"],
                 "context_type": "alerts",
                 "context_id": "",
             },
             None,
         ),
     ])
コード例 #7
0
ファイル: test_alert.py プロジェクト: dchirikov/pcs
 def test_success(self):
     cmd_alert.remove_recipient(self.mock_env, "alert-recipient")
     assert_xml_equal(
         """
         <cib validate-with="pacemaker-2.5">
             <configuration>
                 <alerts>
                     <alert id="alert" path="path">
                         <recipient id="alert-recipient-1" value="value"/>
                     </alert>
                 </alerts>
             </configuration>
         </cib>
         """,
         self.mock_env._get_cib_xml()
     )
コード例 #8
0
ファイル: test_alert.py プロジェクト: rriifftt/pcs
 def test_multiple_recipients(self):
     cmd_alert.remove_recipient(
         self.mock_env,
         ["alert-recipient1", "alert-recipient2", "alert2-recipient4"])
     assert_xml_equal(
         """
         <cib validate-with="pacemaker-2.5">
             <configuration>
                 <alerts>
                     <alert id="alert" path="path"/>
                     <alert id="alert2" path="path">
                         <recipient id="alert2-recipient3" value="value3"/>
                     </alert>
                 </alerts>
             </configuration>
         </cib>
         """, self.mock_env._get_cib_xml())
     self.assertEqual([], self.mock_rep.report_item_list)
コード例 #9
0
ファイル: test_alert.py プロジェクト: thulyacloud/pcs
 def test_recipient_not_found(self):
     self.env_assist.assert_raise_library_error(
         lambda: cmd_alert.remove_recipient(self.env_assist.get_env(
         ), ["recipient", "alert-recip1", "alert2-recip1"]),
         [(Severities.ERROR, report_codes.ID_NOT_FOUND, {
             "id": "recipient"
         }, None),
          (Severities.ERROR, report_codes.ID_NOT_FOUND, {
              "id": "alert2-recip1"
          }, None)],
         expected_in_processor=True)
コード例 #10
0
ファイル: test_alert.py プロジェクト: dchirikov/pcs
 def test_recipient_not_found(self):
     assert_raise_library_error(
         lambda: cmd_alert.remove_recipient(
             self.mock_env, "recipient"
         ),
         (
             Severities.ERROR,
             report_codes.ID_NOT_FOUND,
             {"id": "recipient"}
         )
     )
コード例 #11
0
ファイル: test_alert.py プロジェクト: HideoYamauchi/pcs
 def test_multiple_recipients(self):
     cmd_alert.remove_recipient(
         self.mock_env,
         ["alert-recipient1", "alert-recipient2", "alert2-recipient4"]
     )
     assert_xml_equal(
         """
         <cib validate-with="pacemaker-2.5">
             <configuration>
                 <alerts>
                     <alert id="alert" path="path"/>
                     <alert id="alert2" path="path">
                         <recipient id="alert2-recipient3" value="value3"/>
                     </alert>
                 </alerts>
             </configuration>
         </cib>
         """,
         self.mock_env._get_cib_xml()
     )
     self.assertEqual([], self.mock_rep.report_item_list)
コード例 #12
0
ファイル: test_alert.py プロジェクト: rriifftt/pcs
 def test_recipient_not_found(self):
     report_list = [(Severities.ERROR, report_codes.ID_NOT_FOUND, {
         "id": "recipient"
     }),
                    (Severities.ERROR, report_codes.ID_NOT_FOUND, {
                        "id": "alert2-recipient1"
                    })]
     assert_raise_library_error(
         lambda: cmd_alert.remove_recipient(self.mock_env, [
             "recipient", "alert-recipient1", "alert2-recipient1"
         ]), *report_list)
     assert_report_item_list_equal(self.mock_rep.report_item_list,
                                   report_list)
コード例 #13
0
ファイル: test_alert.py プロジェクト: tomjelinek/pcs
 def test_recipient_not_found(self):
     self.env_assist.assert_raise_library_error(
         lambda: cmd_alert.remove_recipient(
             self.env_assist.get_env(),
             ["recipient", "alert-recip1", "alert2-recip1"]
         ),
         [
             (
                 Severities.ERROR,
                 report_codes.ID_NOT_FOUND,
                 {"id": "recipient"},
                 None
             ),
             (
                 Severities.ERROR,
                 report_codes.ID_NOT_FOUND,
                 {"id": "alert2-recip1"},
                 None
             )
         ],
         expected_in_processor=True
     )
コード例 #14
0
ファイル: test_alert.py プロジェクト: HideoYamauchi/pcs
 def test_recipient_not_found(self):
     report_list = [
         (
             Severities.ERROR,
             report_codes.ID_NOT_FOUND,
             {"id": "recipient"}
         ),
         (
             Severities.ERROR,
             report_codes.ID_NOT_FOUND,
             {"id": "alert2-recipient1"}
         )
     ]
     assert_raise_library_error(
         lambda: cmd_alert.remove_recipient(
             self.mock_env,
             ["recipient", "alert-recipient1", "alert2-recipient1"]
         ),
         *report_list
     )
     assert_report_item_list_equal(
         self.mock_rep.report_item_list, report_list
     )
コード例 #15
0
ファイル: test_alert.py プロジェクト: tomjelinek/pcs
 def test_no_recipient(self):
     self.config.env.push_cib()
     cmd_alert.remove_recipient(
         self.env_assist.get_env(),
         []
     )
コード例 #16
0
 def test_no_recipient(self):
     self.config.env.push_cib()
     cmd_alert.remove_recipient(self.env_assist.get_env(), [])
コード例 #17
0
 def test_recipient_not_found(self):
     assert_raise_library_error(
         lambda: cmd_alert.remove_recipient(self.mock_env, "recipient"),
         (Severities.ERROR, report_codes.ID_NOT_FOUND, {
             "id": "recipient"
         }))