How to use getAttributes method in pyatom

Best Python code snippet using pyatom_python

test_get_attributes.py

Source:test_get_attributes.py Github

copy

Full Screen

1# Licensed under the Apache License, Version 2.0 (the "License"); you may2# not use this file except in compliance with the License. You may obtain3# a copy of the License at4#5# http://www.apache.org/licenses/LICENSE-2.06#7# Unless required by applicable law or agreed to in writing, software8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the10# License for the specific language governing permissions and limitations11# under the License.12import copy13import testtools14from kmip.core import attributes15from kmip.core import enums16from kmip.core import exceptions17from kmip.core import objects18from kmip.core import primitives19from kmip.core import utils20from kmip.core.messages.payloads import get_attributes21class TestGetAttributesRequestPayload(testtools.TestCase):22 """23 Test suite for the GetAttributes request payload.24 """25 def setUp(self):26 super(TestGetAttributesRequestPayload, self).setUp()27 # Encodings taken from Sections 3.1.2 of the KMIP 1.1 testing28 # documentation.29 self.full_encoding = utils.BytearrayStream(30 b'\x42\x00\x79\x01\x00\x00\x00\xA8\x42\x00\x94\x07\x00\x00\x00\x24'31 b'\x31\x37\x30\x33\x32\x35\x30\x62\x2D\x34\x64\x34\x30\x2D\x34\x64'32 b'\x65\x32\x2D\x39\x33\x61\x30\x2D\x63\x34\x39\x34\x61\x31\x64\x34'33 b'\x61\x65\x34\x30\x00\x00\x00\x00\x42\x00\x0A\x07\x00\x00\x00\x0C'34 b'\x4F\x62\x6A\x65\x63\x74\x20\x47\x72\x6F\x75\x70\x00\x00\x00\x00'35 b'\x42\x00\x0A\x07\x00\x00\x00\x20\x41\x70\x70\x6C\x69\x63\x61\x74'36 b'\x69\x6F\x6E\x20\x53\x70\x65\x63\x69\x66\x69\x63\x20\x49\x6E\x66'37 b'\x6F\x72\x6D\x61\x74\x69\x6F\x6E\x42\x00\x0A\x07\x00\x00\x00\x13'38 b'\x43\x6F\x6E\x74\x61\x63\x74\x20\x49\x6E\x66\x6F\x72\x6D\x61\x74'39 b'\x69\x6F\x6E\x00\x00\x00\x00\x00\x42\x00\x0A\x07\x00\x00\x00\x09'40 b'\x78\x2D\x50\x75\x72\x70\x6F\x73\x65\x00\x00\x00\x00\x00\x00\x00'41 )42 self.encoding_sans_unique_identifier = utils.BytearrayStream(43 b'\x42\x00\x79\x01\x00\x00\x00\x78\x42\x00\x0A\x07\x00\x00\x00\x0C'44 b'\x4F\x62\x6A\x65\x63\x74\x20\x47\x72\x6F\x75\x70\x00\x00\x00\x00'45 b'\x42\x00\x0A\x07\x00\x00\x00\x20\x41\x70\x70\x6C\x69\x63\x61\x74'46 b'\x69\x6F\x6E\x20\x53\x70\x65\x63\x69\x66\x69\x63\x20\x49\x6E\x66'47 b'\x6F\x72\x6D\x61\x74\x69\x6F\x6E\x42\x00\x0A\x07\x00\x00\x00\x13'48 b'\x43\x6F\x6E\x74\x61\x63\x74\x20\x49\x6E\x66\x6F\x72\x6D\x61\x74'49 b'\x69\x6F\x6E\x00\x00\x00\x00\x00\x42\x00\x0A\x07\x00\x00\x00\x09'50 b'\x78\x2D\x50\x75\x72\x70\x6F\x73\x65\x00\x00\x00\x00\x00\x00\x00'51 )52 self.encoding_sans_attribute_names = utils.BytearrayStream(53 b'\x42\x00\x79\x01\x00\x00\x00\x30\x42\x00\x94\x07\x00\x00\x00\x24'54 b'\x31\x37\x30\x33\x32\x35\x30\x62\x2D\x34\x64\x34\x30\x2D\x34\x64'55 b'\x65\x32\x2D\x39\x33\x61\x30\x2D\x63\x34\x39\x34\x61\x31\x64\x34'56 b'\x61\x65\x34\x30\x00\x00\x00\x00'57 )58 self.empty_encoding = utils.BytearrayStream(59 b'\x42\x00\x79\x01\x00\x00\x00\x00'60 )61 self.unique_identifier = '1703250b-4d40-4de2-93a0-c494a1d4ae40'62 self.attribute_names = [63 'Object Group',64 'Application Specific Information',65 'Contact Information',66 'x-Purpose'67 ]68 def tearDown(self):69 super(TestGetAttributesRequestPayload, self).tearDown()70 def test_init(self):71 """72 Test that a GetAttributes request payload can be constructed with73 no arguments.74 """75 get_attributes.GetAttributesRequestPayload()76 def test_init_with_args(self):77 """78 Test that a GetAttributes request payload can be constructed with a79 valid value.80 """81 get_attributes.GetAttributesRequestPayload(82 'test-unique-identifier',83 ['test-attribute-name-1', 'test-attribute-name-2']84 )85 def test_unique_identifier(self):86 """87 Test that the unique_identifier attribute of a GetAttributes request88 payload can be properly set and retrieved.89 """90 payload = get_attributes.GetAttributesRequestPayload()91 self.assertIsNone(payload.unique_identifier)92 self.assertIsNone(payload._unique_identifier)93 payload.unique_identifier = 'test-unique-identifier'94 self.assertEqual('test-unique-identifier', payload.unique_identifier)95 self.assertEqual(96 primitives.TextString(97 value='test-unique-identifier',98 tag=enums.Tags.UNIQUE_IDENTIFIER99 ),100 payload._unique_identifier101 )102 def test_unique_identifier_with_invalid_value(self):103 """104 Test that a TypeError is raised when an invalid ID is used to set105 the unique_identifier attribute of a GetAttributes request payload.106 """107 payload = get_attributes.GetAttributesRequestPayload()108 args = (payload, 'unique_identifier', 0)109 self.assertRaisesRegexp(110 TypeError,111 "unique identifier must be a string",112 setattr,113 *args114 )115 def test_attribute_names(self):116 """117 Test that the attribute_names attribute of a GetAttributes request118 payload can be properly set and retrieved.119 """120 payload = get_attributes.GetAttributesRequestPayload()121 self.assertEqual(list(), payload.attribute_names)122 self.assertEqual(list(), payload._attribute_names)123 payload.attribute_names = [124 'test-attribute-name-1',125 'test-attribute-name-2'126 ]127 self.assertEqual(2, len(payload.attribute_names))128 self.assertEqual(2, len(payload._attribute_names))129 self.assertIn('test-attribute-name-1', payload.attribute_names)130 self.assertIn('test-attribute-name-2', payload.attribute_names)131 self.assertIn(132 primitives.TextString(133 value='test-attribute-name-1',134 tag=enums.Tags.ATTRIBUTE_NAME135 ),136 payload._attribute_names137 )138 self.assertIn(139 primitives.TextString(140 value='test-attribute-name-2',141 tag=enums.Tags.ATTRIBUTE_NAME142 ),143 payload._attribute_names144 )145 def test_attribute_names_with_invalid_value(self):146 """147 Test that a TypeError is raised when an invalid list is used to set148 the attribute_names attribute of a GetAttributes request payload.149 """150 payload = get_attributes.GetAttributesRequestPayload()151 args = (payload, 'attribute_names', 0)152 self.assertRaisesRegexp(153 TypeError,154 "attribute_names must be a list of strings",155 setattr,156 *args157 )158 def test_attribute_names_with_invalid_attribute_name(self):159 """160 Test that a TypeError is raised when an invalid attribute name is161 included in the list used to set the attribute_names attribute of a162 GetAttributes request payload.163 """164 payload = get_attributes.GetAttributesRequestPayload()165 args = (166 payload,167 'attribute_names',168 ['test-attribute-name-1', 0]169 )170 self.assertRaisesRegexp(171 TypeError,172 "attribute_names must be a list of strings; "173 "item 2 has type {0}".format(type(0)),174 setattr,175 *args176 )177 def test_attribute_names_with_duplicates(self):178 """179 Test that duplicate attribute names are silently removed when setting180 the attribute_names attribute of a GetAttributes request payload.181 """182 payload = get_attributes.GetAttributesRequestPayload()183 self.assertEqual(list(), payload.attribute_names)184 self.assertEqual(list(), payload._attribute_names)185 payload.attribute_names = [186 'test-attribute-name-1',187 'test-attribute-name-1',188 'test-attribute-name-2'189 ]190 self.assertEqual(2, len(payload.attribute_names))191 self.assertEqual(2, len(payload._attribute_names))192 self.assertIn('test-attribute-name-1', payload.attribute_names)193 self.assertIn('test-attribute-name-2', payload.attribute_names)194 self.assertIn(195 primitives.TextString(196 value='test-attribute-name-1',197 tag=enums.Tags.ATTRIBUTE_NAME198 ),199 payload._attribute_names200 )201 self.assertIn(202 primitives.TextString(203 value='test-attribute-name-2',204 tag=enums.Tags.ATTRIBUTE_NAME205 ),206 payload._attribute_names207 )208 def test_read(self):209 """210 Test that a GetAttributes request payload can be read from a data211 stream.212 """213 payload = get_attributes.GetAttributesRequestPayload()214 self.assertEqual(None, payload._unique_identifier)215 self.assertEqual(list(), payload._attribute_names)216 payload.read(self.full_encoding)217 self.assertEqual(self.unique_identifier, payload.unique_identifier)218 self.assertEqual(219 primitives.TextString(220 value=self.unique_identifier,221 tag=enums.Tags.UNIQUE_IDENTIFIER222 ),223 payload._unique_identifier224 )225 self.assertEqual(226 set(self.attribute_names),227 set(payload.attribute_names)228 )229 for attribute_name in self.attribute_names:230 self.assertIn(231 primitives.TextString(232 value=attribute_name,233 tag=enums.Tags.ATTRIBUTE_NAME234 ),235 payload._attribute_names236 )237 def test_read_with_no_unique_identifier(self):238 """239 Test that a GetAttributes request payload with no ID can be read240 from a data stream.241 """242 payload = get_attributes.GetAttributesRequestPayload()243 self.assertEqual(None, payload._unique_identifier)244 self.assertEqual(list(), payload._attribute_names)245 payload.read(self.encoding_sans_unique_identifier)246 self.assertEqual(None, payload.unique_identifier)247 self.assertEqual(None, payload._unique_identifier)248 self.assertEqual(249 set(self.attribute_names),250 set(payload.attribute_names)251 )252 for attribute_name in self.attribute_names:253 self.assertIn(254 primitives.TextString(255 value=attribute_name,256 tag=enums.Tags.ATTRIBUTE_NAME257 ),258 payload._attribute_names259 )260 def test_read_with_no_attribute_names(self):261 """262 Test that a GetAttributes request payload with no attribute names263 can be read from a data stream.264 """265 payload = get_attributes.GetAttributesRequestPayload()266 self.assertEqual(None, payload._unique_identifier)267 self.assertEqual(list(), payload._attribute_names)268 payload.read(self.encoding_sans_attribute_names)269 self.assertEqual(self.unique_identifier, payload.unique_identifier)270 self.assertEqual(271 primitives.TextString(272 value=self.unique_identifier,273 tag=enums.Tags.UNIQUE_IDENTIFIER274 ),275 payload._unique_identifier276 )277 self.assertEqual(list(), payload.attribute_names)278 self.assertEqual(list(), payload._attribute_names)279 def test_read_with_no_content(self):280 """281 Test that a GetAttributes request payload with no ID or attribute282 names can be read from a data stream.283 """284 payload = get_attributes.GetAttributesRequestPayload()285 self.assertEqual(None, payload._unique_identifier)286 self.assertEqual(list(), payload._attribute_names)287 payload.read(self.empty_encoding)288 self.assertEqual(None, payload.unique_identifier)289 self.assertEqual(None, payload._unique_identifier)290 self.assertEqual(list(), payload.attribute_names)291 self.assertEqual(list(), payload._attribute_names)292 def test_write(self):293 """294 Test that a GetAttributes request payload can be written to a data295 stream.296 """297 payload = get_attributes.GetAttributesRequestPayload(298 self.unique_identifier,299 self.attribute_names300 )301 stream = utils.BytearrayStream()302 payload.write(stream)303 self.assertEqual(len(self.full_encoding), len(stream))304 self.assertEqual(str(self.full_encoding), str(stream))305 def test_write_with_no_unique_identifier(self):306 """307 Test that a GetAttributes request payload with no ID can be written308 to a data stream.309 """310 payload = get_attributes.GetAttributesRequestPayload(311 None,312 self.attribute_names313 )314 stream = utils.BytearrayStream()315 payload.write(stream)316 self.assertEqual(317 len(self.encoding_sans_unique_identifier),318 len(stream)319 )320 self.assertEqual(321 str(self.encoding_sans_unique_identifier),322 str(stream)323 )324 def test_write_with_no_attribute_names(self):325 """326 Test that a GetAttributes request payload with no attribute names327 can be written to a data stream.328 """329 payload = get_attributes.GetAttributesRequestPayload(330 self.unique_identifier,331 None332 )333 stream = utils.BytearrayStream()334 payload.write(stream)335 self.assertEqual(len(self.encoding_sans_attribute_names), len(stream))336 self.assertEqual(str(self.encoding_sans_attribute_names), str(stream))337 def test_write_with_no_content(self):338 """339 Test that a GetAttributes request payload with no ID or attribute340 names can be written to a data stream.341 """342 payload = get_attributes.GetAttributesRequestPayload()343 stream = utils.BytearrayStream()344 payload.write(stream)345 self.assertEqual(len(self.empty_encoding), len(stream))346 self.assertEqual(str(self.empty_encoding), str(stream))347 def test_repr(self):348 """349 Test that repr can be applied to a GetAttributes request payload.350 """351 payload = get_attributes.GetAttributesRequestPayload(352 self.unique_identifier,353 self.attribute_names354 )355 unique_identifier = "unique_identifier={0}".format(356 payload.unique_identifier357 )358 attribute_names = "attribute_names={0}".format(359 payload.attribute_names360 )361 expected = "GetAttributesRequestPayload({0}, {1})".format(362 unique_identifier,363 attribute_names364 )365 observed = repr(payload)366 self.assertEqual(expected, observed)367 def test_repr_with_no_unique_identifier(self):368 """369 Test that repr can be applied to a GetAttributes request payload with370 no ID.371 """372 payload = get_attributes.GetAttributesRequestPayload(373 None,374 self.attribute_names375 )376 unique_identifier = "unique_identifier={0}".format(377 payload.unique_identifier378 )379 attribute_names = "attribute_names={0}".format(380 payload.attribute_names381 )382 expected = "GetAttributesRequestPayload({0}, {1})".format(383 unique_identifier,384 attribute_names385 )386 observed = repr(payload)387 self.assertEqual(expected, observed)388 def test_repr_with_no_attribute_names(self):389 """390 Test that repr can be applied to a GetAttributes request payload with391 no attribute names.392 """393 payload = get_attributes.GetAttributesRequestPayload(394 self.unique_identifier,395 None396 )397 unique_identifier = "unique_identifier={0}".format(398 payload.unique_identifier399 )400 attribute_names = "attribute_names={0}".format(401 payload.attribute_names402 )403 expected = "GetAttributesRequestPayload({0}, {1})".format(404 unique_identifier,405 attribute_names406 )407 observed = repr(payload)408 self.assertEqual(expected, observed)409 def test_repr_with_no_content(self):410 """411 Test that repr can be applied to a GetAttributes request payload with412 no ID or attribute names.413 """414 payload = get_attributes.GetAttributesRequestPayload(415 None,416 None417 )418 unique_identifier = "unique_identifier={0}".format(419 payload.unique_identifier420 )421 attribute_names = "attribute_names={0}".format(422 payload.attribute_names423 )424 expected = "GetAttributesRequestPayload({0}, {1})".format(425 unique_identifier,426 attribute_names427 )428 observed = repr(payload)429 self.assertEqual(expected, observed)430 def test_str(self):431 """432 Test that str can be applied to a GetAttributes request payload.433 """434 payload = get_attributes.GetAttributesRequestPayload(435 self.unique_identifier,436 self.attribute_names437 )438 expected = str({439 'unique_identifier': self.unique_identifier,440 'attribute_names': self.attribute_names441 })442 observed = str(payload)443 self.assertEqual(expected, observed)444 def test_str_with_no_id(self):445 """446 Test that str can be applied to a GetAttributes request payload with447 no ID.448 """449 payload = get_attributes.GetAttributesRequestPayload(450 None,451 self.attribute_names452 )453 expected = str({454 'unique_identifier': None,455 'attribute_names': self.attribute_names456 })457 observed = str(payload)458 self.assertEqual(expected, observed)459 def test_str_with_no_attribute_names(self):460 """461 Test that str can be applied to a GetAttributes request payload with462 no attribute names.463 """464 payload = get_attributes.GetAttributesRequestPayload(465 self.unique_identifier,466 None467 )468 expected = str({469 'unique_identifier': self.unique_identifier,470 'attribute_names': list()471 })472 observed = str(payload)473 self.assertEqual(expected, observed)474 def test_str_with_no_content(self):475 """476 Test that str can be applied to a GetAttributes request payload with477 no ID or attribute names.478 """479 payload = get_attributes.GetAttributesRequestPayload(480 None,481 None482 )483 expected = str({484 'unique_identifier': None,485 'attribute_names': list()486 })487 observed = str(payload)488 self.assertEqual(expected, observed)489 def test_equal_on_equal(self):490 """491 Test that the equality operator returns True when comparing two492 GetAttributes request payloads with the same data.493 """494 a = get_attributes.GetAttributesRequestPayload(495 self.unique_identifier,496 self.attribute_names497 )498 b = get_attributes.GetAttributesRequestPayload(499 self.unique_identifier,500 self.attribute_names501 )502 self.assertTrue(a == b)503 self.assertTrue(b == a)504 def test_equal_with_mixed_attribute_names(self):505 """506 Test that the equality operator returns True when comparing two507 GetAttributes request payload with the same attribute_name sets508 but with different attribute name orderings.509 """510 a = get_attributes.GetAttributesRequestPayload(511 self.unique_identifier,512 self.attribute_names513 )514 self.attribute_names.reverse()515 b = get_attributes.GetAttributesRequestPayload(516 self.unique_identifier,517 self.attribute_names518 )519 self.assertTrue(a == b)520 self.assertTrue(b == a)521 def test_equal_on_not_equal_unique_identifier(self):522 """523 Test that the equality operator returns False when comparing two524 GetAttributes request payloads with different IDs.525 """526 a = get_attributes.GetAttributesRequestPayload(527 self.unique_identifier,528 self.attribute_names529 )530 b = get_attributes.GetAttributesRequestPayload(531 'invalid',532 self.attribute_names533 )534 self.assertFalse(a == b)535 self.assertFalse(b == a)536 def test_equal_on_not_equal_attribute_names(self):537 """538 Test that the equality operator returns False when comparing two539 GetAttributes request payloads with different attribute names.540 """541 a = get_attributes.GetAttributesRequestPayload(542 self.unique_identifier,543 self.attribute_names544 )545 b = get_attributes.GetAttributesRequestPayload(546 self.unique_identifier,547 None548 )549 self.assertFalse(a == b)550 self.assertFalse(b == a)551 def test_equal_on_type_mismatch(self):552 """553 Test that the equality operator returns False when comparing a554 GetAttributes request payload to a non-GetAttributes request555 payload.556 """557 a = get_attributes.GetAttributesRequestPayload(558 self.unique_identifier,559 self.attribute_names560 )561 b = "invalid"562 self.assertFalse(a == b)563 self.assertFalse(b == a)564 def test_not_equal_on_equal(self):565 """566 Test that the inequality operator returns False when comparing567 two GetAttributes request payloads with the same internal data.568 """569 a = get_attributes.GetAttributesRequestPayload(570 self.unique_identifier,571 self.attribute_names572 )573 b = get_attributes.GetAttributesRequestPayload(574 self.unique_identifier,575 self.attribute_names576 )577 self.assertFalse(a != b)578 self.assertFalse(b != a)579 def test_not_equal_on_not_equal_unique_identifier(self):580 """581 Test that the inequality operator returns True when comparing two582 GetAttributes request payloads with different IDs.583 """584 a = get_attributes.GetAttributesRequestPayload(585 self.unique_identifier,586 self.attribute_names587 )588 b = get_attributes.GetAttributesRequestPayload(589 'invalid',590 self.attribute_names591 )592 self.assertTrue(a != b)593 self.assertTrue(b != a)594 def test_not_equal_on_not_equal_attribute_names(self):595 """596 Test that the inequality operator returns True when comparing two597 GetAttributes request payloads with different attribute names.598 """599 a = get_attributes.GetAttributesRequestPayload(600 self.unique_identifier,601 self.attribute_names602 )603 b = get_attributes.GetAttributesRequestPayload(604 self.unique_identifier,605 None606 )607 self.assertTrue(a != b)608 self.assertTrue(b != a)609 def test_not_equal_on_type_mismatch(self):610 """611 Test that the equality operator returns True when comparing a612 GetAttributes request payload to a non-GetAttributes request613 payload.614 """615 a = get_attributes.GetAttributesRequestPayload(616 self.unique_identifier,617 self.attribute_names618 )619 b = "invalid"620 self.assertTrue(a != b)621 self.assertTrue(b != a)622class TestGetAttributesResponsePayload(testtools.TestCase):623 """624 Test suite for the GetAttributes response payload.625 """626 def setUp(self):627 super(TestGetAttributesResponsePayload, self).setUp()628 # Encodings taken from Sections 3.1.2 of the KMIP 1.1 testing629 # documentation.630 self.full_encoding = utils.BytearrayStream(631 b'\x42\x00\x7C\x01\x00\x00\x01\x30\x42\x00\x94\x07\x00\x00\x00\x24'632 b'\x31\x37\x30\x33\x32\x35\x30\x62\x2D\x34\x64\x34\x30\x2D\x34\x64'633 b'\x65\x32\x2D\x39\x33\x61\x30\x2D\x63\x34\x39\x34\x61\x31\x64\x34'634 b'\x61\x65\x34\x30\x00\x00\x00\x00\x42\x00\x08\x01\x00\x00\x00\x28'635 b'\x42\x00\x0A\x07\x00\x00\x00\x0C\x4F\x62\x6A\x65\x63\x74\x20\x47'636 b'\x72\x6F\x75\x70\x00\x00\x00\x00\x42\x00\x0B\x07\x00\x00\x00\x06'637 b'\x47\x72\x6F\x75\x70\x31\x00\x00\x42\x00\x08\x01\x00\x00\x00\x58'638 b'\x42\x00\x0A\x07\x00\x00\x00\x20\x41\x70\x70\x6C\x69\x63\x61\x74'639 b'\x69\x6F\x6E\x20\x53\x70\x65\x63\x69\x66\x69\x63\x20\x49\x6E\x66'640 b'\x6F\x72\x6D\x61\x74\x69\x6F\x6E\x42\x00\x0B\x01\x00\x00\x00\x28'641 b'\x42\x00\x03\x07\x00\x00\x00\x03\x73\x73\x6C\x00\x00\x00\x00\x00'642 b'\x42\x00\x02\x07\x00\x00\x00\x0F\x77\x77\x77\x2E\x65\x78\x61\x6D'643 b'\x70\x6C\x65\x2E\x63\x6F\x6D\x00\x42\x00\x08\x01\x00\x00\x00\x30'644 b'\x42\x00\x0A\x07\x00\x00\x00\x13\x43\x6F\x6E\x74\x61\x63\x74\x20'645 b'\x49\x6E\x66\x6F\x72\x6D\x61\x74\x69\x6F\x6E\x00\x00\x00\x00\x00'646 b'\x42\x00\x0B\x07\x00\x00\x00\x03\x4A\x6F\x65\x00\x00\x00\x00\x00'647 b'\x42\x00\x08\x01\x00\x00\x00\x30\x42\x00\x0A\x07\x00\x00\x00\x09'648 b'\x78\x2D\x50\x75\x72\x70\x6F\x73\x65\x00\x00\x00\x00\x00\x00\x00'649 b'\x42\x00\x0B\x07\x00\x00\x00\x0D\x64\x65\x6D\x6F\x6E\x73\x74\x72'650 b'\x61\x74\x69\x6F\x6E\x00\x00\x00'651 )652 self.encoding_sans_unique_identifier = utils.BytearrayStream(653 b'\x42\x00\x7C\x01\x00\x00\x01\x00\x42\x00\x08\x01\x00\x00\x00\x28'654 b'\x42\x00\x0A\x07\x00\x00\x00\x0C\x4F\x62\x6A\x65\x63\x74\x20\x47'655 b'\x72\x6F\x75\x70\x00\x00\x00\x00\x42\x00\x0B\x07\x00\x00\x00\x06'656 b'\x47\x72\x6F\x75\x70\x31\x00\x00\x42\x00\x08\x01\x00\x00\x00\x58'657 b'\x42\x00\x0A\x07\x00\x00\x00\x20\x41\x70\x70\x6C\x69\x63\x61\x74'658 b'\x69\x6F\x6E\x20\x53\x70\x65\x63\x69\x66\x69\x63\x20\x49\x6E\x66'659 b'\x6F\x72\x6D\x61\x74\x69\x6F\x6E\x42\x00\x0B\x01\x00\x00\x00\x28'660 b'\x42\x00\x03\x07\x00\x00\x00\x03\x73\x73\x6C\x00\x00\x00\x00\x00'661 b'\x42\x00\x02\x07\x00\x00\x00\x0F\x77\x77\x77\x2E\x65\x78\x61\x6D'662 b'\x70\x6C\x65\x2E\x63\x6F\x6D\x00\x42\x00\x08\x01\x00\x00\x00\x30'663 b'\x42\x00\x0A\x07\x00\x00\x00\x13\x43\x6F\x6E\x74\x61\x63\x74\x20'664 b'\x49\x6E\x66\x6F\x72\x6D\x61\x74\x69\x6F\x6E\x00\x00\x00\x00\x00'665 b'\x42\x00\x0B\x07\x00\x00\x00\x03\x4A\x6F\x65\x00\x00\x00\x00\x00'666 b'\x42\x00\x08\x01\x00\x00\x00\x30\x42\x00\x0A\x07\x00\x00\x00\x09'667 b'\x78\x2D\x50\x75\x72\x70\x6F\x73\x65\x00\x00\x00\x00\x00\x00\x00'668 b'\x42\x00\x0B\x07\x00\x00\x00\x0D\x64\x65\x6D\x6F\x6E\x73\x74\x72'669 b'\x61\x74\x69\x6F\x6E\x00\x00\x00'670 )671 self.encoding_sans_attributes = utils.BytearrayStream(672 b'\x42\x00\x7C\x01\x00\x00\x00\x30\x42\x00\x94\x07\x00\x00\x00\x24'673 b'\x31\x37\x30\x33\x32\x35\x30\x62\x2D\x34\x64\x34\x30\x2D\x34\x64'674 b'\x65\x32\x2D\x39\x33\x61\x30\x2D\x63\x34\x39\x34\x61\x31\x64\x34'675 b'\x61\x65\x34\x30\x00\x00\x00\x00'676 )677 self.unique_identifier = '1703250b-4d40-4de2-93a0-c494a1d4ae40'678 self.attributes = [679 objects.Attribute(680 attribute_name=objects.Attribute.AttributeName(681 'Object Group'682 ),683 attribute_value=attributes.ObjectGroup('Group1')684 ),685 objects.Attribute(686 attribute_name=objects.Attribute.AttributeName(687 'Application Specific Information'688 ),689 attribute_value=attributes.ApplicationSpecificInformation(690 attributes.ApplicationNamespace('ssl'),691 attributes.ApplicationData('www.example.com')692 )693 ),694 objects.Attribute(695 attribute_name=objects.Attribute.AttributeName(696 'Contact Information'697 ),698 attribute_value=attributes.ContactInformation('Joe')699 ),700 objects.Attribute(701 attribute_name=objects.Attribute.AttributeName('x-Purpose'),702 attribute_value=primitives.TextString('demonstration')703 )704 ]705 def tearDown(self):706 super(TestGetAttributesResponsePayload, self).tearDown()707 def test_init(self):708 """709 Test that a GetAttributes response payload can be constructed.710 """711 get_attributes.GetAttributesResponsePayload()712 def test_init_with_args(self):713 """714 Test that a GetAttributes response payload can be constructed with a715 valid value.716 """717 get_attributes.GetAttributesResponsePayload(718 'test-unique-identifier',719 [objects.Attribute(), objects.Attribute()]720 )721 def test_unique_identifier(self):722 """723 Test that the unique_identifier attribute of a GetAttributes response724 payload can be properly set and retrieved.725 """726 payload = get_attributes.GetAttributesResponsePayload()727 self.assertIsNone(payload.unique_identifier)728 self.assertIsNone(payload._unique_identifier)729 payload.unique_identifier = 'test-unique-identifier'730 self.assertEqual('test-unique-identifier', payload.unique_identifier)731 self.assertEqual(732 primitives.TextString(733 value='test-unique-identifier',734 tag=enums.Tags.UNIQUE_IDENTIFIER735 ),736 payload._unique_identifier737 )738 def test_unique_identifier_with_invalid_value(self):739 """740 Test that a TypeError is raised when an invalid ID is used to set741 the unique_identifier attribute of a GetAttributes response payload.742 """743 payload = get_attributes.GetAttributesResponsePayload()744 args = (payload, 'unique_identifier', 0)745 self.assertRaisesRegexp(746 TypeError,747 "unique identifier must be a string",748 setattr,749 *args750 )751 def test_attributes(self):752 """753 Test that the attributes attribute of a GetAttributes response754 payload can be properly set and retrieved.755 """756 payload = get_attributes.GetAttributesResponsePayload()757 self.assertEqual(list(), payload.attributes)758 self.assertEqual(list(), payload._attributes)759 payload.attributes = [760 objects.Attribute(),761 objects.Attribute()762 ]763 self.assertEqual(2, len(payload.attributes))764 self.assertEqual(2, len(payload._attributes))765 for attribute in payload._attributes:766 self.assertIsInstance(attribute, objects.Attribute)767 def test_attributes_with_invalid_value(self):768 """769 Test that a TypeError is raised when an invalid list is used to set770 the attributes attribute of a GetAttributes response payload.771 """772 payload = get_attributes.GetAttributesResponsePayload()773 args = (payload, 'attributes', 0)774 self.assertRaisesRegexp(775 TypeError,776 "attributes must be a list of attribute objects",777 setattr,778 *args779 )780 def test_attributes_with_invalid_attribute(self):781 """782 Test that a TypeError is raised when an invalid attribute is included783 in the list used to set the attributes attribute of a GetAttributes784 response payload.785 """786 payload = get_attributes.GetAttributesResponsePayload()787 args = (788 payload,789 'attributes',790 [objects.Attribute(), 0]791 )792 self.assertRaisesRegexp(793 TypeError,794 "attributes must be a list of attribute objects; "795 "item 2 has type {0}".format(type(0)),796 setattr,797 *args798 )799 def test_read(self):800 """801 Test that a GetAttributes response payload can be read from a data802 stream.803 """804 payload = get_attributes.GetAttributesResponsePayload()805 self.assertEqual(None, payload._unique_identifier)806 self.assertEqual(list(), payload._attributes)807 payload.read(self.full_encoding)808 self.assertEqual(self.unique_identifier, payload.unique_identifier)809 self.assertEqual(810 primitives.TextString(811 value=self.unique_identifier,812 tag=enums.Tags.UNIQUE_IDENTIFIER813 ),814 payload._unique_identifier815 )816 self.assertEqual(817 len(self.attributes),818 len(payload.attributes)819 )820 for attribute in self.attributes:821 self.assertIn(822 attribute,823 payload._attributes824 )825 def test_read_with_no_unique_identifier(self):826 """827 Test that an InvalidKmipEncoding error gets raised when attempting to828 read a GetAttributes response encoding with no ID data.829 """830 payload = get_attributes.GetAttributesResponsePayload()831 self.assertEqual(None, payload._unique_identifier)832 self.assertEqual(list(), payload._attributes)833 args = (self.encoding_sans_unique_identifier, )834 self.assertRaisesRegexp(835 exceptions.InvalidKmipEncoding,836 "expected GetAttributes response unique identifier not found",837 payload.read,838 *args839 )840 def test_read_with_no_attributes(self):841 """842 Test that a GetAttributes response payload without attribute name843 data can be read from a data stream.844 """845 payload = get_attributes.GetAttributesResponsePayload()846 self.assertEqual(None, payload._unique_identifier)847 self.assertEqual(list(), payload._attributes)848 payload.read(self.encoding_sans_attributes)849 self.assertEqual(self.unique_identifier, payload.unique_identifier)850 self.assertEqual(851 primitives.TextString(852 value=self.unique_identifier,853 tag=enums.Tags.UNIQUE_IDENTIFIER854 ),855 payload._unique_identifier856 )857 self.assertEqual(list(), payload.attributes)858 self.assertEqual(list(), payload._attributes)859 def test_write(self):860 """861 Test that a GetAttributes response payload can be written to a data862 stream.863 """864 payload = get_attributes.GetAttributesResponsePayload(865 self.unique_identifier,866 self.attributes867 )868 stream = utils.BytearrayStream()869 payload.write(stream)870 self.assertEqual(len(self.full_encoding), len(stream))871 self.assertEqual(str(self.full_encoding), str(stream))872 def test_write_with_no_unique_identifier(self):873 """874 Test that a GetAttributes request payload with no ID can be written875 to a data stream.876 """877 payload = get_attributes.GetAttributesResponsePayload(878 None,879 self.attributes880 )881 stream = utils.BytearrayStream()882 args = (stream, )883 self.assertRaisesRegexp(884 exceptions.InvalidField,885 "The GetAttributes response unique identifier is required.",886 payload.write,887 *args888 )889 def test_write_with_no_attribute_names(self):890 """891 Test that a GetAttributes response payload with no attribute name892 data can be written to a data stream.893 """894 payload = get_attributes.GetAttributesResponsePayload(895 self.unique_identifier,896 None897 )898 stream = utils.BytearrayStream()899 payload.write(stream)900 self.assertEqual(len(self.encoding_sans_attributes), len(stream))901 self.assertEqual(str(self.encoding_sans_attributes), str(stream))902 def test_repr(self):903 """904 Test that repr can be applied to a GetAttributes response payload.905 """906 payload = get_attributes.GetAttributesResponsePayload(907 self.unique_identifier,908 self.attributes909 )910 unique_identifier = "unique_identifier={0}".format(911 payload.unique_identifier912 )913 payload_attributes = "attributes={0}".format(914 payload.attributes915 )916 expected = "GetAttributesResponsePayload({0}, {1})".format(917 unique_identifier,918 payload_attributes919 )920 observed = repr(payload)921 self.assertEqual(expected, observed)922 def test_str(self):923 """924 Test that str can be applied to a GetAttributes response payload.925 """926 payload = get_attributes.GetAttributesResponsePayload(927 self.unique_identifier,928 self.attributes929 )930 expected = str({931 'unique_identifier': self.unique_identifier,932 'attributes': self.attributes933 })934 observed = str(payload)935 self.assertEqual(expected, observed)936 def test_equal_on_equal(self):937 """938 Test that the equality operator returns True when comparing two939 GetAttributes response payloads with the same data.940 """941 a = get_attributes.GetAttributesResponsePayload(942 self.unique_identifier,943 self.attributes944 )945 b = get_attributes.GetAttributesResponsePayload(946 self.unique_identifier,947 self.attributes948 )949 self.assertTrue(a == b)950 self.assertTrue(b == a)951 def test_equal_on_not_equal_unique_identifier(self):952 """953 Test that the equality operator returns False when comparing two954 GetAttributes response payloads with different data.955 """956 a = get_attributes.GetAttributesResponsePayload(957 self.unique_identifier,958 self.attributes959 )960 b = get_attributes.GetAttributesResponsePayload(961 'invalid',962 self.attributes963 )964 self.assertFalse(a == b)965 self.assertFalse(b == a)966 def test_equal_on_not_equal_attributes(self):967 """968 Test that the equality operator returns False when comparing two969 GetAttributes response payloads with different data.970 """971 a = get_attributes.GetAttributesResponsePayload(972 self.unique_identifier,973 self.attributes974 )975 reversed_attributes = copy.deepcopy(self.attributes)976 reversed_attributes.reverse()977 b = get_attributes.GetAttributesResponsePayload(978 self.unique_identifier,979 reversed_attributes980 )981 self.assertFalse(a == b)982 self.assertFalse(b == a)983 def test_equal_on_not_equal_attributes_count(self):984 """985 Test that the equality operator returns False when comparing two986 GetAttributes response payloads with different data.987 """988 a = get_attributes.GetAttributesResponsePayload(989 self.unique_identifier,990 self.attributes991 )992 b = get_attributes.GetAttributesResponsePayload(993 self.unique_identifier,994 list()995 )996 self.assertFalse(a == b)997 self.assertFalse(b == a)998 def test_equal_on_not_equal_attributes_types(self):999 """1000 Test that the equality operator returns False when comparing two1001 GetAttributes response payloads with different data.1002 """1003 a = get_attributes.GetAttributesResponsePayload(1004 self.unique_identifier,1005 None1006 )1007 b = get_attributes.GetAttributesResponsePayload(1008 self.unique_identifier,1009 self.attributes1010 )1011 self.assertFalse(a == b)1012 self.assertFalse(b == a)1013 def test_equal_on_type_mismatch(self):1014 """1015 Test that the equality operator returns False when comparing a1016 GetAttributes response payload to a non-GetAttributes response1017 payload.1018 """1019 a = get_attributes.GetAttributesResponsePayload(1020 self.unique_identifier,1021 self.attributes1022 )1023 b = 'invalid'1024 self.assertFalse(a == b)1025 self.assertFalse(b == a)1026 def test_not_equal_on_equal(self):1027 """1028 Test that the inequality operator returns False when comparing1029 two GetAttributes response payloads with the same internal data.1030 """1031 a = get_attributes.GetAttributesResponsePayload(1032 self.unique_identifier,1033 self.attributes1034 )1035 b = get_attributes.GetAttributesResponsePayload(1036 self.unique_identifier,1037 self.attributes1038 )1039 self.assertFalse(a != b)1040 self.assertFalse(b != a)1041 def test_not_equal_on_not_equal_unique_identifier(self):1042 """1043 Test that the inequality operator returns True when comparing two1044 GetAttributes request payloads with different data.1045 """1046 a = get_attributes.GetAttributesResponsePayload(1047 self.unique_identifier,1048 self.attributes1049 )1050 b = get_attributes.GetAttributesResponsePayload(1051 'invalid',1052 self.attributes1053 )1054 self.assertTrue(a != b)1055 self.assertTrue(b != a)1056 def test_not_equal_on_not_equal_attributes(self):1057 """1058 Test that the inequality operator returns False when comparing two1059 GetAttributes response payloads with different data.1060 """1061 a = get_attributes.GetAttributesResponsePayload(1062 self.unique_identifier,1063 self.attributes1064 )1065 reversed_attributes = copy.deepcopy(self.attributes)1066 reversed_attributes.reverse()1067 b = get_attributes.GetAttributesResponsePayload(1068 self.unique_identifier,1069 reversed_attributes1070 )1071 self.assertTrue(a != b)1072 self.assertTrue(b != a)1073 def test_not_equal_on_not_equal_attributes_count(self):1074 """1075 Test that the inequality operator returns False when comparing two1076 GetAttributes response payloads with different data.1077 """1078 a = get_attributes.GetAttributesResponsePayload(1079 self.unique_identifier,1080 self.attributes1081 )1082 b = get_attributes.GetAttributesResponsePayload(1083 self.unique_identifier,1084 list()1085 )1086 self.assertTrue(a != b)1087 self.assertTrue(b != a)1088 def test_not_equal_on_not_equal_attributes_types(self):1089 """1090 Test that the inequality operator returns False when comparing two1091 GetAttributes response payloads with different data.1092 """1093 a = get_attributes.GetAttributesResponsePayload(1094 self.unique_identifier,1095 None1096 )1097 b = get_attributes.GetAttributesResponsePayload(1098 self.unique_identifier,1099 self.attributes1100 )1101 self.assertTrue(a != b)1102 self.assertTrue(b != a)1103 def test_not_equal_on_type_mismatch(self):1104 """1105 Test that the inequality operator returns True when comparing a1106 GetAttributes response payload to a non-GetAttributes response1107 payload.1108 """1109 a = get_attributes.GetAttributesResponsePayload(1110 self.unique_identifier,1111 self.attributes1112 )1113 b = "invalid"1114 self.assertTrue(a != b)...

Full Screen

Full Screen

Flash.js

Source:Flash.js Github

copy

Full Screen

...28 },29 testSetSource : function(value)30 {31 this.__flash.setSource("movieURL");32 this.assertIdentical("movieURL", this.__flash.getAttributes().movie);33 },34 testSetId : function(value)35 {36 this.__flash.setId("flashID");37 this.assertIdentical("flashID", this.__flash.getAttributes().id);38 },39 testSetVariables : function(value)40 {41 var map = {a: "valueA", b: "valueB"};42 this.__flash.setVariables(map);43 this.assertIdentical(map, this.__flash.getVariables());44 },45 testSetAttribute : function (key, value)46 {47 this.__flash.setAttribute("attrib1", "hoho");48 this.__flash.setAttribute("attrib2", "gogo");49 this.__flash.setAttribute("attrib3", true);50 this.__flash.setAttribute("attrib4", false);51 var map = this.__flash.getAttribute();52 this.assertIdentical("hoho", this.__flash.getAttributes().attrib1);53 this.assertIdentical("gogo", this.__flash.getAttributes().attrib2);54 this.assertTrue(this.__flash.getAttributes().attrib3);55 this.assertFalse(this.__flash.getAttributes().attrib4);56 this.__flash.setAttribute("attrib1");57 this.__flash.setAttribute("attrib3");58 this.assertUndefined(this.__flash.getAttributes().attrib1);59 this.assertIdentical("gogo", this.__flash.getAttributes().attrib2);60 this.assertUndefined(this.__flash.getAttributes().attrib3);61 this.assertFalse(this.__flash.getAttributes().attrib4);62 this.__flash.setAttribute("attrib2", null);63 this.__flash.setAttribute("attrib4", null);64 this.assertUndefined(this.__flash.getAttributes().attrib1);65 this.assertUndefined(this.__flash.getAttributes().attrib2);66 this.assertUndefined(this.__flash.getAttributes().attrib3);67 this.assertUndefined(this.__flash.getAttributes().attrib4);68 },69 testSetParam : function(key, value)70 {71 this.__flash.setParam("param1", "hoho");72 this.__flash.setParam("param2", "gogo");73 this.__flash.setParam("param3", true);74 this.__flash.setParam("param4", false);75 var map = this.__flash.getParams();76 this.assertIdentical("hoho", this.__flash.getParams().param1);77 this.assertIdentical("gogo", this.__flash.getParams().param2);78 this.assertTrue(this.__flash.getParams().param3);79 this.assertFalse(this.__flash.getParams().param4);80 this.__flash.setParam("param1");81 this.__flash.setParam("param3");...

Full Screen

Full Screen

attendee.test.ts

Source:attendee.test.ts Github

copy

Full Screen

2import Attendee from './attendee';3import Response from './response';4it('can set an identifier for the attendee', async () => {5 const attendee = new Attendee();6 expect(attendee.as(1).getAttributes()).toEqual(7 expect.objectContaining({8 identifier: 1,9 }),10 );11});12it('can set an external identifier for the attendee', async () => {13 const attendee = new Attendee();14 expect(attendee.alias('ABC-123').getAttributes()).toEqual(15 expect.objectContaining({16 alias: 'ABC-123',17 }),18 );19})20it('can set answers when providing a single answer', async () => {21 const answer = new Answer();22 const attendee = new Attendee();23 expect(attendee.answers(answer).getAttributes()).toEqual(24 expect.objectContaining({25 answers: [answer],26 }),27 );28});29it('can set answers when providing multiple answers', async () => {30 const answer = new Answer();31 const attendee = new Attendee();32 expect(attendee.answers([answer, answer]).getAttributes()).toEqual(33 expect.objectContaining({34 answers: [answer, answer],35 }),36 );37});38it('can set responses when providing a single response', async () => {39 const response = new Response();40 const attendee = new Attendee();41 expect(attendee.responses(response).getAttributes()).toEqual(42 expect.objectContaining({43 responses: [response],44 }),45 );46});47it('can set responses when providing multiple responses', async () => {48 const response = new Response();49 const attendee = new Attendee();50 expect(attendee.responses([response, response]).getAttributes()).toEqual(51 expect.objectContaining({52 responses: [response, response],53 }),54 );55});56it('can set location detail parameters and maintain existing attributes', async () => {57 const attendee = new Attendee();58 const details = {59 address: '123 Fake St',60 city: 'Fake City',61 country: 'FC',62 postcode: 'X0X 0X0',63 region: 'FR',64 timezone: 'UTC',65 };66 expect(attendee.located(details).getAttributes()).toEqual(67 expect.objectContaining({68 ...attendee.getAttributes(),69 ...details,70 }),71 );72});73it('can set that an attendee is messagable', async () => {74 const attendee = new Attendee();75 expect(attendee.messagable().getAttributes()).toEqual(76 expect.objectContaining({77 messagable: true,78 }),79 );80});81it('can set that an attendee is not messagable', async () => {82 const attendee = new Attendee();83 expect(attendee.messagable(false).getAttributes()).toEqual(84 expect.objectContaining({85 messagable: false,86 }),87 );88});89it('can set an attendees first and last name', async () => {90 const attendee = new Attendee();91 expect(attendee.named('Jane', 'Doe').getAttributes()).toEqual(92 expect.objectContaining({93 first_name: 'Jane',94 last_name: 'Doe',95 }),96 );97});98it('can set any additional notes an attendee provides', async () => {99 const attendee = new Attendee();100 expect(attendee.provided('notes').getAttributes()).toEqual(101 expect.objectContaining({102 notes: 'notes',103 }),104 );105});106it('can set the reachable details and maintain existing attributes', async () => {107 const attendee = new Attendee();108 const details = {109 cell_phone: '5555555555',110 email: 'jane@doe.com',111 phone: '5555555555',112 work_phone: '5555555555',113 };114 expect(attendee.reachable(details).getAttributes()).toEqual(115 expect.objectContaining({116 ...attendee.getAttributes(),117 ...details,118 }),119 );120});121it('can set the language of the attendee', async () => {122 const attendee = new Attendee();123 expect(attendee.speaks('es').getAttributes()).toEqual(124 expect.objectContaining({125 language: 'es',126 }),127 );...

Full Screen

Full Screen

Message.py

Source:Message.py Github

copy

Full Screen

...12 13 def addAttribute(self, name, value):14 self.attributes.append(Attribute(name, value))15 16 def getAttributes(self):17 return self.attributes18 19 def getName(self):20 return self.getAttributes()[0].value21 22 def isSameOrChildMessage(self, message):23 if len(message.getAttributes()) < len(self.attributes):24 return False25 26 for i in xrange(len(self.attributes)):27 if message.getAttributes()[i].name != self.getAttributes()[i].name:28 return False29 30 if message.getAttributes()[i].value != self.getAttributes()[i].value:31 return False32 33 return True34 35 def addRecursively(self, message):36 """37 Adds a new child to this method and calls insert method recursively.38 """39 newChild = Message(message.getName())40 41 for i in xrange(1, len(self.attributes) + 1):42 newChild.addAttribute(message.getAttributes()[i].name, message.getAttributes()[i].value)43 44 self.childMessages.append(newChild)45 newChild.insertMessage(message, False)46 47 def insertMessage(self, message, preserveTimeLine):48 """49 Inserts the given message into this message or recursively50 into a child message.51 """52 if not self.isSameOrChildMessage(message):53 #print self.getName() + ": Rejected (Not same or child)"54 return False55 56 if preserveTimeLine:57 if len(self.childMessages) > 0:58 if self.childMessages[-1].insertMessage(message, preserveTimeLine):59 #print self.getName() + ": Added in subtree"60 self.number += 161 return True62 else:63 for childMessage in self.childMessages:64 if childMessage.insertMessage(message, preserveTimeLine):65 #print self.getName() + ": Added in subtree"66 self.number += 167 return True68 if len(message.getAttributes()) == len(self.getAttributes()):69 pass70 #print self.getName() + ": Added as same"71 elif len(message.getAttributes()) == len(self.getAttributes()) + 1:72 #print self.getName() + ": Added as child"73 message.number = 174 self.childMessages.append(message)75 else:76 #print self.getName() + ": Added recursively"77 self.addRecursively(message)78 79 self.number += 180 return True81 def printXML(self, indent, file):82 """83 Prints this message in XML style.84 """85 startTag = "<" + self.getName() + " "86 87 if self.number > 1:88 startTag += "number=" + "\"" + str(self.number) + "\" "89 90 #for attribute in self.getAttributes():91 # if attribute.name != "messageType":92 # startTag += attribute.name + "=\"" + attribute.value + "\" "93 if len(self.getAttributes()) > 0:94 startTag += self.getAttributes()[-1].name + "=\"" + self.getAttributes()[-1].value + "\" "95 96 if len(self.childMessages) == 0:97 startTag += "/>"98 else:99 startTag += ">"100 101 file.write((" " * indent) + startTag + "\n")102 103 #Descend104 for childMessage in self.childMessages:105 childMessage.printXML(indent + 1, file)106 107 if len(self.childMessages) > 0:108 endTag = "</" + self.getName() + ">"...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pyatom automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful