コード例 #1
0
    def test_put_kv_txn_does_request_with_specified_timeout(self):
        put_kv_txn(self.mapping, timeout=10)

        self.request.urlopen.assert_called_once_with(
            self.request.Request.return_value,
            timeout=10
        )
コード例 #2
0
    def test_put_kv_txn_does_request(self):
        put_kv_txn(self.mapping)

        self.request.urlopen.assert_called_once_with(
            self.request.Request.return_value,
            timeout=socket._GLOBAL_DEFAULT_TIMEOUT
        )
コード例 #3
0
ファイル: test_put_txn.py プロジェクト: yy1117/consul-kv
    def test_put_kv_txn_instantiates_request_object(self):
        put_kv_txn(self.mapping)

        self.request.Request.assert_called_once_with(
            url='http://localhost:8500/v1/txn',
            data=self.expected_data,
            method='PUT',
            headers={'Content-Type': 'application/json'})
コード例 #4
0
ファイル: test_put_txn.py プロジェクト: yy1117/consul-kv
    def test_put_kv_txn_instantiates_request_object_with_specified_endpoint(
            self):
        put_kv_txn(self.mapping, endpoint='http://some_host:8500/v1/txn/')

        self.request.Request.assert_called_once_with(
            url='http://some_host:8500/v1/txn/',
            data=self.expected_data,
            method='PUT',
            headers={'Content-Type': 'application/json'})
コード例 #5
0
ファイル: test_put_txn.py プロジェクト: yy1117/consul-kv
    def test_put_kv_txn_instantiates_request_object_with_specified_verb(self):
        put_kv_txn(self.mapping, verb='cas')

        self.expected_data = json.dumps(
            _mapping_to_txn_data(self.mapping, verb='cas')).encode('utf-8')
        self.request.Request.assert_called_once_with(
            url='http://localhost:8500/v1/txn',
            data=self.expected_data,
            method='PUT',
            headers={'Content-Type': 'application/json'})
コード例 #6
0
ファイル: test_put_txn.py プロジェクト: yy1117/consul-kv
    def test_put_kv_txn_logs_debug_message(self):
        put_kv_txn(self.mapping)

        self.assertTrue(self.log.debug.called)