Exemplo n.º 1
0
    def test_happy_path(self):
        username = '******'
        password = '******'
        appliesTo = 'test_appliesTo'
        templateRST = open(os.path.join(os.getcwd(), 'tests', 'wstrust', 'RST.xml'), mode='r').read()
        rst = templateRST \
            .replace('%USERNAME%', username) \
            .replace('%PASSWORD%', password) \
            .replace('%APPLIES_TO%', appliesTo) \
            .replace('%WSTRUST_ENDPOINT%', wstrustEndpoint)

        #rstRequest = setupUpOutgoingRSTCompare(rst)
        request = WSTrustRequest(_call_context, wstrustEndpoint, appliesTo)

        # TODO: handle rstr should be mocked out to prevent handling here.
        # TODO: setupUpOutgoingRSTCompare.  Use this to get messageid, created, expires, etc comparisons.

        httpretty.register_uri(method=httpretty.POST, uri=wstrustEndpoint, status=200, body='')

        request._handle_rstr =mock.MagicMock()

        def callback():
            pass

        request.acquire_token(username, password, callback)