Example #1
0
 def test_node_communicator_all_options(self, mock_comm):
     expected_comm = mock.MagicMock()
     mock_comm.return_value = expected_comm
     user = "******"
     groups = ["some", "group"]
     tokens = {"node": "token"}
     timeout = 10
     env = LibraryEnvironment(
         self.mock_logger,
         self.mock_reporter,
         user_login=user,
         user_groups=groups,
         auth_tokens_getter=lambda:tokens,
         request_timeout=timeout
     )
     comm = env.node_communicator()
     self.assertEqual(expected_comm, comm)
     mock_comm.assert_called_once_with(
         self.mock_logger,
         self.mock_reporter,
         tokens,
         user,
         groups,
         timeout
     )
Example #2
0
 def test_node_communicator_no_options(self, mock_comm):
     expected_comm = mock.MagicMock()
     mock_comm.return_value = expected_comm
     env = LibraryEnvironment(self.mock_logger, self.mock_reporter)
     comm = env.node_communicator()
     self.assertEqual(expected_comm, comm)
     mock_comm.assert_called_once_with(self.mock_logger, self.mock_reporter,
                                       {}, None, [])
Example #3
0
 def test_node_communicator_no_options(self, mock_comm):
     expected_comm = mock.MagicMock()
     mock_comm.return_value = expected_comm
     env = LibraryEnvironment(self.mock_logger, self.mock_reporter)
     comm = env.node_communicator()
     self.assertEqual(expected_comm, comm)
     mock_comm.assert_called_once_with(
         self.mock_logger,
         self.mock_reporter,
         {},
         None,
         []
     )
Example #4
0
 def test_node_communicator_all_options(self, mock_comm):
     expected_comm = mock.MagicMock()
     mock_comm.return_value = expected_comm
     user = "******"
     groups = ["some", "group"]
     tokens = {"node": "token"}
     env = LibraryEnvironment(self.mock_logger,
                              self.mock_reporter,
                              user_login=user,
                              user_groups=groups,
                              auth_tokens_getter=lambda: tokens)
     comm = env.node_communicator()
     self.assertEqual(expected_comm, comm)
     mock_comm.assert_called_once_with(self.mock_logger, self.mock_reporter,
                                       tokens, user, groups)