<commit_before>#!/usr/bin/env python
# encoding: utf-8

"""Tests for Octokit."""

import unittest

import octokit
import pytest


class AuthenticationTestCase(unittest.TestCase):

    _multiprocess_can_split_ = True

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_basic(self):
        hub = octokit.Octokit(login='', password='')
        assert hub.basic_authenticated is True

    def test_token(self):
        hub = octokit.Octokit(access_token='', client_secret='')
        assert hub.basic_authenticated is False
        assert hub.token_authenticated is True

    def test_application(self):
        hub = octokit.Octokit(client_id='', client_secret='')
        assert hub.basic_authenticated is False
        assert hub.token_authenticated is False
        assert hub.application_authenticated is True

    def test_user(self):
        hub = octokit.Octokit(login='', password='')
        hub_two = octokit.Octokit(access_token='', client_secret='')

        assert hub.application_authenticated is False
        assert hub_two.application_authenticated is False

        assert hub.user_authenticated is True
        assert hub_two.user_authenticated is True<commit_msg>Base user test case added.<commit_after>#!/usr/bin/env python
# encoding: utf-8

"""Tests for Octokit."""

import unittest

import octokit
import pytest


class AuthenticationTestCase(unittest.TestCase):

    _multiprocess_can_split_ = True

    def test_unauthenticated(self):
        hub = octokit.Octokit()
        assert hub.authenticated is False

    def test_basic(self):
        hub = octokit.Octokit(login='', password='')
        assert hub.authenticated is True
        assert hub.basic_authenticated is True

    def test_token(self):
        hub = octokit.Octokit(access_token='', client_secret='')
        assert hub.basic_authenticated is False

        assert hub.authenticated is True
        assert hub.token_authenticated is True

    def test_application(self):
        hub = octokit.Octokit(client_id='', client_secret='')
        assert hub.basic_authenticated is False
        assert hub.token_authenticated is False

        assert hub.authenticated is True
        assert hub.application_authenticated is True

    def test_user(self):
        hub = octokit.Octokit(login='', password='')
        hub_two = octokit.Octokit(access_token='', client_secret='')
        assert hub.application_authenticated is False
        assert hub_two.application_authenticated is False

        assert hub.user_authenticated is True
        assert hub_two.user_authenticated is True

        assert hub.authenticated is True
        assert hub_two.authenticated is True


class UserTestCase(unittest.TestCase):

    _multiprocess_can_split_ = True

    def test_user(self):
        user = octokit.Octokit(login='', password='').user
        assert user.name == ''

    def test_another_user(self):
        hub = octokit.Octokit(login='', password='')
        assert hub.users['username'].name == ''

    def test_users(self):
        users = octokit.Octokit(login='', password='').users
        assert len(users) == 100
        assert len(users.next()) == 100  # get the second page of the results
{'fraction_non_alphanumeric': 0.09186840471756673, 'fraction_numerical': 0.002482929857231533, 'mean_word_length': 3.074589127686473, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5474846', 'n_tokens_mistral': 978, 'n_tokens_neox': 917, 'n_words': 233}