Пример #1
0
    def test_raises_value_error_on_sastoken_failure(self, mocker, client_class,
                                                    connection_string):
        sastoken_mock = mocker.patch.object(st, "SasToken")
        token_err = st.SasTokenError("Some SasToken failure")
        sastoken_mock.side_effect = token_err

        with pytest.raises(ValueError) as e_info:
            client_class.create_from_connection_string(connection_string)
        assert e_info.value.__cause__ is token_err
Пример #2
0
    def test_raises_value_error_on_sastoken_failure(self, mocker, client_class,
                                                    edge_container_environment,
                                                    mock_edge_hsm):
        mocker.patch.dict(os.environ, edge_container_environment, clear=True)
        sastoken_mock = mocker.patch.object(st, "SasToken")
        token_err = st.SasTokenError("Some SasToken failure")
        sastoken_mock.side_effect = token_err

        with pytest.raises(ValueError) as e_info:
            client_class.create_from_edge_environment()
        assert e_info.value.__cause__ is token_err
Пример #3
0
    def test_raises_value_error_on_sastoken_failure(self, mocker,
                                                    client_class):
        sastoken_mock = mocker.patch.object(st, "SasToken")
        token_err = st.SasTokenError("Some SasToken failure")
        sastoken_mock.side_effect = token_err

        with pytest.raises(ValueError) as e_info:
            client_class.create_from_symmetric_key(
                symmetric_key=self.symmetric_key,
                hostname=self.hostname,
                device_id=self.device_id)
        assert e_info.value.__cause__ is token_err
Пример #4
0
    def test_sastoken_failure(self, mocker, client_class):
        sastoken_mock = mocker.patch.object(st, "RenewableSasToken")
        token_err = st.SasTokenError("Some SasToken failure")
        sastoken_mock.side_effect = token_err

        with pytest.raises(ValueError) as e_info:
            client_class.create_from_symmetric_key(
                provisioning_host=fake_provisioning_host,
                registration_id=fake_registration_id,
                id_scope=fake_id_scope,
                symmetric_key=fake_symmetric_key,
            )
        assert e_info.value.__cause__ is token_err