def testParseHeaderWeirdCases(self): authentication = BasicAuthentication(realm='Test Realm') self.assertEqual(None, authentication._parseHeader(b"bla bla bla")) self.assertEqual( None, authentication._parseHeader( b"NonsenseInPart0 QWxhZGRpbjpvcGVuIHNlc2FtZQ==")) self.assertEqual( None, authentication._parseHeader(b"Basic " + b64encode(b"nonsense")))
def testParseHeaderWeirdCases(self): authentication = BasicAuthentication(realm='Test Realm') self.assertEquals(None, authentication._parseHeader("bla bla bla")) self.assertEquals(None, authentication._parseHeader("NonsenseInPart0 QWxhZGRpbjpvcGVuIHNlc2FtZQ==")) self.assertEquals(None, authentication._parseHeader("Basic " + b64encode("nonsense")))
def testParseHeader(self): authentication = BasicAuthentication(realm='Test Realm') self.assertEquals(("username", "password"), authentication._parseHeader("Basic " + b64encode("username:password")))