Beispiel #1
0
    def decorated_view(*args, **kwargs):
        travis_token = travis_utils.is_travis_user(current_user.github_token)

        if travis_token is None:
            return jsonify(dict(message=messages.NO_TRAVIS_ACCOUNT))
        else:
            current_user.set_travis_token(travis_token)
        return func(*args, **kwargs)
Beispiel #2
0
    def test_should_confirm_travis_user(self):
        # Given
        token_mock = Mock(return_value=TRAVIS_TOKEN)

        # When
        with patch('travis_utils.get_access_token', token_mock):
            token = travis_utils.is_travis_user(GH_TOKEN)

        # Then
        # Note: We don't check if token is equal to expected token,
        # since a failure would mean the token being exposed in the error
        # output
        self.assertTrue(isinstance(token, basestring))
Beispiel #3
0
 def test_should_detect_bogus_user(self):
     self.assertIsNone(travis_utils.is_travis_user(BOGUS))