<commit_before># -*- encoding: utf-8 -*-

# Dissemin: open access policy enforcement tool
# Copyright (C) 2014 <NAME>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#

import unittest
from datetime import date
from django.test import TestCase
from django.test.utils import override_settings
from django.contrib.auth.models import User
from django.forms import Form
from papers.models import OaiSource
from backend.tests import PrefilledTest
from backend.globals import get_ccf
from deposit.models import Repository, DepositRecord
from deposit.protocol import DepositResult
from django.core.files.uploadedfile import InMemoryUploadedFile
from io import BytesIO

# 1x1 px image used as default logo for the repository
simple_png_image = b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x01\x00\x00\x00\x01\x08\x02\x00\x00\x00\x90wS\xde\x00\x00\x00\tpHYs\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a\x9c\x18\x00\x00\x00\x07tIME\x07\xdf\n\x12\x0c+\x19\x84\x1d/"\x00\x00\x00\x19tEXtComment\x00Created with GIMPW\x81\x0e\x17\x00\x00\x00\x0cIDAT\x08\xd7c\xa8\xa9\xa9\x01\x00\x02\xec\x01u\x90\x90\x1eL\x00\x00\x00\x00IEND\xaeB`\x82'

# for sample abstracts
lorem_ipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

class ProtocolTest(PrefilledTest):
    """
    Set of generic tests that any protocol should pass.
    """
    def __init__(self, *args, **kwargs):
        super(ProtocolTest, self).__init__(*args, **kwargs)

    @classmethod
    @override_settings(MEDIA_ROOT='mediatest/')
    def setUpClass(self):
        super(ProtocolTest, self).setUpClass()
        if self is ProtocolTest:
             raise unittest.SkipTest("Base test")
        self.ccf = get_ccf()
        self.p1 = self.ccf.get_or_create_paper(
                "This is a test paper",
                [self.r1.name, self.r2.name, self.r4.name],
                date(year=2014,month=02,day=15))
        self.ccf.commitThemAll()<commit_msg>Skip deposit test on Travis<commit_after># -*- encoding: utf-8 -*-

# Dissemin: open access policy enforcement tool
# Copyright (C) 2014 <NAME>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#

import unittest
from datetime import date
from django.test import TestCase
from django.test.utils import override_settings
from django.contrib.auth.models import User
from django.forms import Form
from papers.models import OaiSource
from backend.tests import PrefilledTest
from backend.globals import get_ccf
from deposit.models import Repository, DepositRecord
from deposit.protocol import DepositResult
from django.core.files.uploadedfile import InMemoryUploadedFile
from io import BytesIO
import os

# 1x1 px image used as default logo for the repository
simple_png_image = b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x01\x00\x00\x00\x01\x08\x02\x00\x00\x00\x90wS\xde\x00\x00\x00\tpHYs\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a\x9c\x18\x00\x00\x00\x07tIME\x07\xdf\n\x12\x0c+\x19\x84\x1d/"\x00\x00\x00\x19tEXtComment\x00Created with GIMPW\x81\x0e\x17\x00\x00\x00\x0cIDAT\x08\xd7c\xa8\xa9\xa9\x01\x00\x02\xec\x01u\x90\x90\x1eL\x00\x00\x00\x00IEND\xaeB`\x82'

# for sample abstracts
lorem_ipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

class ProtocolTest(PrefilledTest):
    """
    Set of generic tests that any protocol should pass.
    """
    def __init__(self, *args, **kwargs):
        super(ProtocolTest, self).__init__(*args, **kwargs)

    @classmethod
    @override_settings(MEDIA_ROOT='mediatest/')
    def setUpClass(self):
        super(ProtocolTest, self).setUpClass()
        if self is ProtocolTest:
             raise unittest.SkipTest("Base test")
        if 'TRAVIS' in os.environ:
            raise unittest.SkipTest("Skipping deposit test on Travis to avoid mass submissions to sandboxes")
        self.ccf = get_ccf()
        self.p1 = self.ccf.get_or_create_paper(
                "This is a test paper",
                [self.r1.name, self.r2.name, self.r4.name],
                date(year=2014,month=02,day=15))
        self.ccf.commitThemAll()
{'fraction_non_alphanumeric': 0.08651192988151274, 'fraction_numerical': 0.05356273332251258, 'mean_word_length': 3.810304449648712, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6134742', 'n_tokens_mistral': 2279, 'n_tokens_neox': 2083, 'n_words': 645}