class WhenTestingWorkerRegistrationObject(unittest.TestCase): def setUp(self): self.worker_reg = WorkerRegistration('correlation', 'new') def test_WorkerRegistration_new(self): worker_dict = self.worker_reg.format() self.assertTrue('hostname' in worker_dict) self.assertTrue('ip_address_v4' in worker_dict) self.assertTrue('ip_address_v6' in worker_dict) self.assertTrue('personality' in worker_dict) self.assertTrue('status' in worker_dict) self.assertTrue('system_info' in worker_dict)
class WhenTestingWorkerRegistrationObject(unittest.TestCase): def setUp(self): self.worker_reg = WorkerRegistration('correlation', 'new') def test_WorkerRegistration_new(self): worker_dict = self.worker_reg.format() self.assertTrue('hostname' in worker_dict) self.assertTrue('ip_address_v4' in worker_dict) self.assertTrue('ip_address_v6' in worker_dict) self.assertTrue('personality' in worker_dict) self.assertTrue('status' in worker_dict) self.assertTrue('system_info' in worker_dict)
def _pair_with_coordinator(self, api_secret, coordinator_uri, personality): #get registration info and call the coordinator worker_registration = WorkerRegistration(personality) registration = {'worker_registration': worker_registration.format()} auth_header = {'X-AUTH-TOKEN': api_secret} #register with coordinator if self._register_with_coordinator(coordinator_uri, personality, registration, auth_header): server = NativeProxy() server.restart()
def _pair_with_coordinator(self, api_secret, coordinator_uri, personality): #get registration info and call the coordinator worker_registration = WorkerRegistration(personality) registration = {'worker_registration': worker_registration.format()} auth_header = {'X-AUTH-TOKEN': api_secret} #register with coordinator if self._register_with_coordinator( coordinator_uri, personality, registration, auth_header): server = NativeProxy() server.restart()