Ejemplo n.º 1
0
    def test_auth_type_stored_in_session_file(self, httpbin):
        self.config_dir = mk_config_dir()
        self.session_path = self.config_dir / 'test-session.json'

        class Plugin(AuthPlugin):
            auth_type = 'test-saved'
            auth_require = True

            def get_auth(self, username=None, password=None):
                return basic_auth()

        plugin_manager.register(Plugin)
        http(
            '--session',
            str(self.session_path),
            httpbin + '/basic-auth/user/password',
            '--auth-type',
            Plugin.auth_type,
            '--auth',
            'user:password',
        )
        updated_session = json.loads(self.session_path.read_text())
        assert updated_session['auth']['type'] == 'test-saved'
        assert updated_session['auth']['raw_auth'] == "user:password"
        plugin_manager.unregister(Plugin)
Ejemplo n.º 2
0
    def setup_method(self, method):
        self.config_dir = mk_config_dir()

        orig_session = {
            'cookies': {
                'cookie1': {
                    'value': 'foo',
                },
                'cookie2': {
                    'value': 'foo',
                }
            }
        }
        self.session_path = self.config_dir / 'test-session.json'
        self.session_path.write_text(json.dumps(orig_session))
 def start_session(self, httpbin):
     """Create and reuse a unique config dir for each test."""
     self.config_dir = mk_config_dir()
 def start_session(self, httpbin):
     """Create and reuse a unique config dir for each test."""
     self.config_dir = mk_config_dir()
Ejemplo n.º 5
0
 def setup_method(self, method):
     """Create and reuse a unique config dir for each test."""
     self.config_dir = mk_config_dir()
Ejemplo n.º 6
0
 def setup_method(self, method):
     """Create and reuse a unique config dir for each test."""
     self.config_dir = mk_config_dir()
Ejemplo n.º 7
0
 def setup_method(self, method):
     self.config_dir = mk_config_dir()