Ejemplo n.º 1
0
    def test_one_method(self, request_builder):
        # Setup
        basic_auth = self.setup_basic_auth()
        multi_auth = auth.MultiAuth(basic_auth)

        # Verify
        assert len(multi_auth) == 1
        assert multi_auth[0] == basic_auth

        multi_auth(request_builder)
        self.verify_basic_auth(basic_auth, request_builder)
Ejemplo n.º 2
0
    def test_extend(self, request_builder):
        # Setup
        basic_auth = self.setup_basic_auth()
        proxy_auth = self.setup_proxy_auth()
        multi_auth = auth.MultiAuth()
        multi_auth.extend([basic_auth, proxy_auth])

        # Verify
        assert len(multi_auth) == 2
        assert multi_auth[0] == basic_auth
        assert multi_auth[1] == proxy_auth

        multi_auth(request_builder)
        self.verify_basic_auth(basic_auth, request_builder)
        self.verify_proxy_auth(proxy_auth, request_builder)
Ejemplo n.º 3
0
    def test_four_methods(self, request_builder):
        # Setup
        param_auth = self.setup_param_auth()
        basic_auth = self.setup_basic_auth()
        proxy_auth = self.setup_proxy_auth()
        multi_auth = auth.MultiAuth(None, param_auth, basic_auth, proxy_auth)

        # Verify
        assert len(multi_auth) == 4
        assert multi_auth[0] == utils.no_op
        assert multi_auth[1] == param_auth
        assert multi_auth[2] == basic_auth
        assert multi_auth[3] == proxy_auth

        multi_auth(request_builder)
        self.verify_param_auth(request_builder)
        self.verify_basic_auth(basic_auth, request_builder)
        self.verify_proxy_auth(proxy_auth, request_builder)
Ejemplo n.º 4
0
 def test_none(self):
     multi_auth = auth.MultiAuth(None)
     assert len(multi_auth) == 1
     assert multi_auth[0] == utils.no_op
Ejemplo n.º 5
0
 def test_len(self):
     multi_auth = auth.MultiAuth()
     assert len(multi_auth) == 0