Ejemplo n.º 1
0
 def testNexus(self):
     protocol = msn.PassportNexus(self.deferred,
                                  'https://foobar.com/somepage.quux')
     headers = {
         'Content-Length':
         '0',
         'Content-Type':
         'text/html',
         'PassportURLs':
         'DARealm=Passport.Net,DALogin=login.myserver.com/,DAReg=reg.myserver.com'
     }
     transport = StringIOWithoutClosing()
     protocol.makeConnection(transport)
     protocol.dataReceived('HTTP/1.0 200 OK\r\n')
     for (h, v) in headers.items():
         protocol.dataReceived('%s: %s\r\n' % (h, v))
     protocol.dataReceived('\r\n')
     self.failUnless(self.result[0] == "https://login.myserver.com/")
Ejemplo n.º 2
0
 def test_nexus(self):
     """
     When L{msn.PassportNexus} receives enough information to identify the
     address of the login server, it fires the L{Deferred} passed to its
     initializer with that address.
     """
     protocol = msn.PassportNexus(self.deferred, 'https://foobar.com/somepage.quux')
     headers = {
         'Content-Length' : '0',
         'Content-Type'   : 'text/html',
         'PassportURLs'   : 'DARealm=Passport.Net,DALogin=login.myserver.com/,DAReg=reg.myserver.com'
     }
     transport = StringTransport()
     protocol.makeConnection(transport)
     protocol.dataReceived('HTTP/1.0 200 OK\r\n')
     for (h, v) in headers.items():
         protocol.dataReceived('%s: %s\r\n' % (h,v))
     protocol.dataReceived('\r\n')
     self.assertEquals(self.result[0], "https://login.myserver.com/")