def create_master_node_settings(self): self.master_node_settings = { 'master_node_uid': str(uuid.uuid4()), } self.master_node_settings.update(self.master_node_settings_template) MasterNodeSettings.create(self.master_node_settings) self.db.commit()
def test_master_node_in_headers(self, requests_post): requests_post.return_value = Mock(status_code=200) sender = StatsSender() url = '' data = {} master_node_uid = 'xxx' MasterNodeSettings.create({'master_node_uid': master_node_uid}) sender.send_data_to_url(url=url, data={}) requests_post.assert_called_once_with( url, headers={'content-type': 'application/json', 'master-node-uid': master_node_uid}, data=json.dumps(data), timeout=settings.COLLECTOR_RESP_TIMEOUT)
def test_master_node_in_headers(self, requests_post): requests_post.return_value = Mock(status_code=200) sender = StatsSender() url = '' data = {} master_node_uid = 'xxx' MasterNodeSettings.create({'master_node_uid': master_node_uid}) sender.send_data_to_url(url=url, data={}) requests_post.assert_called_once_with( url, headers={ 'content-type': 'application/json', 'master-node-uid': master_node_uid }, data=json.dumps(data), timeout=settings.COLLECTOR_RESP_TIMEOUT)