<commit_before>import sure
from django.contrib.auth.models import User
from tastypie.test import ResourceTestCase
from tools.tests import MockGithubMixin
from tasks.models import Tasks
from .. import models
from . import factories


class ProjectsResourceCase(MockGithubMixin, ResourceTestCase):
    """User projects resources case"""

    def setUp(self):
        MockGithubMixin.setUp(self)
        ResourceTestCase.setUp(self)
        self.user = User.objects.create_user(
            'test', '<EMAIL>', 'test',
        )
        self.api_client.client.login(
            username='test',
            password='<PASSWORD>',
        )
        self.url = '/api/v1/projects/project/'

    def test_read_list(self):
        """Test read list"""
        User.github.get_user.return_value.get_repos.return_value =\
            map(self._create_repo, range(10))
        response = self.api_client.get('{}?fetch=true'.format(self.url))
        response.status_code.should.be.equal(200)
        self.deserialize(response)['meta']['total_count'].should.be.equal(10)

    def test_read_self(self):
        """Test read self"""
        project = factories.ProjectFactory.create(owner=self.user)
        response = self.api_client.get('{}{}/'.format(self.url, project.name))
        response.status_code.should.be.equal(200)

    def test_read_other(self):
        """Test read other"""
        project = factories.ProjectFactory.create()
        response = self.api_client.get('{}{}/'.format(self.url, project.name))<commit_msg>Mock make https in project resources case<commit_after>import sure
from mock import MagicMock
from django.contrib.auth.models import User
from tastypie.test import ResourceTestCase
from tools.tests import MockGithubMixin
from tasks.models import Tasks
from .. import models
from . import factories


class ProjectsResourceCase(MockGithubMixin, ResourceTestCase):
    """User projects resources case"""

    def setUp(self):
        MockGithubMixin.setUp(self)
        ResourceTestCase.setUp(self)
        self._mock_make_https()
        self.user = User.objects.create_user(
            'test', '<EMAIL>', 'test',
        )
        self.api_client.client.login(
            username='test',
            password='<PASSWORD>',
        )
        self.url = '/api/v1/projects/project/'

    def _mock_make_https(self):
        """Mock make_https"""
        self._orig_make_https = models.make_https
        models.make_https = MagicMock(return_value='')

    def tearDown(self):
        super(ProjectsResourceCase, self).tearDown()
        models.make_https = self._orig_make_https

    def test_read_list(self):
        """Test read list"""
        User.github.get_user.return_value.get_repos.return_value =\
            map(self._create_repo, range(10))
        response = self.api_client.get('{}?fetch=true'.format(self.url))
        response.status_code.should.be.equal(200)
        self.deserialize(response)['meta']['total_count'].should.be.equal(10)

    def test_read_self(self):
        """Test read self"""
        project = factories.ProjectFactory.create(owner=self.user)
        response = self.api_client.get('{}{}/'.format(self.url, project.name))
        response.status_code.should.be.equal(200)

    def test_read_other(self):
        """Test read other"""
        project = factories.ProjectFactory.create()
        response = self.api_client.get('{}{}/'.format(self.url, project.name))
{'fraction_non_alphanumeric': 0.12861736334405144, 'fraction_numerical': 0.006430868167202572, 'mean_word_length': 3.0258823529411765, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '6253036', 'n_tokens_mistral': 1018, 'n_tokens_neox': 989, 'n_words': 180}