Пример #1
0
    def _process_discover_versions(self, payload):
        self._logger.info("Processing operation: DiscoverVersions")
        supported_versions = list()

        if len(payload.protocol_versions) > 0:
            for version in payload.protocol_versions:
                if version in self._protocol_versions:
                    supported_versions.append(version)
        else:
            supported_versions = self._protocol_versions

        response_payload = discover_versions.DiscoverVersionsResponsePayload(
            protocol_versions=supported_versions)

        return response_payload
Пример #2
0
    def test_write_with_two_protocol_versions(self):
        payload = discover_versions.DiscoverVersionsResponsePayload(
            self.protocol_versions_two)
        expected = self.encoding_two

        self._test_write(payload, expected)
Пример #3
0
    def test_write_with_empty_protocol_list(self):
        payload = discover_versions.DiscoverVersionsResponsePayload(
            self.protocol_versions_empty)
        expected = self.encoding_empty

        self._test_write(payload, expected)
Пример #4
0
    def test_read_with_two_protocol_versions(self):
        stream = self.encoding_two
        payload = discover_versions.DiscoverVersionsResponsePayload()
        protocol_versions = self.protocol_versions_two

        self._test_read(stream, payload, protocol_versions)
Пример #5
0
    def test_read_with_empty_protocol_list(self):
        stream = self.encoding_empty
        payload = discover_versions.DiscoverVersionsResponsePayload()
        protocol_versions = self.protocol_versions_empty

        self._test_read(stream, payload, protocol_versions)
Пример #6
0
 def test_init_with_args(self):
     discover_versions.DiscoverVersionsResponsePayload(
         self.protocol_versions_empty)
Пример #7
0
 def test_init_with_none(self):
     discover_versions.DiscoverVersionsResponsePayload()
Пример #8
0
 def _create_discover_versions_payload(self):
     return discover_versions.DiscoverVersionsResponsePayload()