Example #1
0
    def test_cib_not_set(self, mock_get_cib, mock_push_cib):
        cib_data = "test cib data"
        new_cib_data = "new test cib data"
        mock_get_cib.return_value = cib_data
        env = LibraryEnvironment(self.mock_logger, self.mock_reporter)

        self.assertTrue(env.is_cib_live)

        self.assertEqual(cib_data, env.get_cib_xml())
        self.assertEqual(1, mock_get_cib.call_count)

        env.push_cib_xml(new_cib_data)
        self.assertEqual(1, mock_push_cib.call_count)
Example #2
0
    def test_cib_set(self, mock_get_cib, mock_push_cib):
        cib_data = "test cib data"
        new_cib_data = "new test cib data"
        env = LibraryEnvironment(
            self.mock_logger,
            self.mock_reporter,
            cib_data=cib_data
        )

        self.assertFalse(env.is_cib_live)

        self.assertEqual(cib_data, env.get_cib_xml())
        self.assertEqual(0, mock_get_cib.call_count)

        env.push_cib_xml(new_cib_data)
        self.assertEqual(0, mock_push_cib.call_count)

        self.assertEqual(new_cib_data, env.get_cib_xml())
        self.assertEqual(0, mock_get_cib.call_count)