Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metodo BaseTest.open_with_auth può essere rimosso #64

Open
Soraph opened this issue Jun 9, 2017 · 0 comments
Open

Metodo BaseTest.open_with_auth può essere rimosso #64

Soraph opened this issue Jun 9, 2017 · 0 comments

Comments

@Soraph
Copy link
Contributor

Soraph commented Jun 9, 2017

def open_with_auth(self, url, method, email, password, data):
        return self.app.open(
            url, method=method, headers={'Authorization': 'Basic ' + base64.b64encode(
                bytes(email + ":" + password, 'ascii')).decode('ascii')}, data=data)

Credo possa essere sostituito con un metodo che generi la stringa per Headers da passare alla chiamata necessaria nel test (che sia self.post, self.get, etc..) invece che complicare il tutto con tutti questi parametri.

Qualcosa del tipo:

def authenticated_headers(self, email, password):
    return {
        'Authorization': 'Basic ' + base64.b64encode(bytes(email + ":" + password, 'ascii')).decode('ascii')
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant