<commit_before>#!/usr/bin/env python2

__author__ = '<EMAIL>; <EMAIL>'


"""
This test case validates Rhino's convenience zipUpload Tests for ZIP ingestion.
"""

from ..api.RequestObject.zip_ingestion_json import ZIPIngestionJson
import resources

class ZipIngestionTest(ZIPIngestionJson):

  def setUp(self):
    self.already_done = 0

  def tearDown(self):
    """
    Purge all objects and collections created in the test case
    """
    if self.already_done > 0: return
    # Delete article and crepo objects
    self.delete_test_article()

  def test_zip_ingestion(self):
    """
    POST zips: Forced ingestion of ZIP archive
    """
    print('\nTesting POST zips/\n')
    # Invoke ZIP API
    self.post_ingestible_zip(resources.ZIP_ARTICLE, force_reingest=True)
    # Validate HTTP code in the response is 201 (CREATED)
    self.verify_http_code_is(resources.CREATED)
    # Validate response with Article table
    self.verify_article()
    # Validate response with Syndication table
    self.verify_syndications()
    # Validate response with Journal table
    self.verify_journals()
    # Validate response with CitedArticle and CitedPerson tables
    self.verify_citedArticles()
    # Validate response with ArticleAsset table
    self.verify_article_file(resources.PDF_CONTENT_TYPE, 'articlePdf')
    self.verify_article_file(resources.XML_CONTENT_TYPE, 'articleXml')
    self.verify_article_figures()
    self.verify_article_graphics()

  def test_zip_ingestion_force_false(self):
    """
    POST zips: Not forced ingestion of ZIP archive
    """
    print('\nTesting POST zips/ and not force reingest\n')
    # Ingest a ZIP file
    self.post_ingestible_zip(resources.ZIP_ARTICLE, force_reingest=True)
    # Validate HTTP code in the response is 201 (CREATED)<commit_msg>dev-DPRO-1183: Dropping the force_reingest parameter in the force_false test case<commit_after>#!/usr/bin/env python2

__author__ = '<EMAIL>; <EMAIL>'


"""
This test case validates Rhino's convenience zipUpload Tests for ZIP ingestion.
"""

from ..api.RequestObject.zip_ingestion_json import ZIPIngestionJson
import resources

class ZipIngestionTest(ZIPIngestionJson):

  def setUp(self):
    self.already_done = 0

  def tearDown(self):
    """
    Purge all objects and collections created in the test case
    """
    if self.already_done > 0: return
    # Delete article and crepo objects
    self.delete_test_article()

  def test_zip_ingestion(self):
    """
    POST zips: Forced ingestion of ZIP archive
    """
    print('\nTesting POST zips/\n')
    # Invoke ZIP API
    self.post_ingestible_zip(resources.ZIP_ARTICLE, force_reingest=True)
    # Validate HTTP code in the response is 201 (CREATED)
    self.verify_http_code_is(resources.CREATED)
    # Validate response with Article table
    self.verify_article()
    # Validate response with Syndication table
    self.verify_syndications()
    # Validate response with Journal table
    self.verify_journals()
    # Validate response with CitedArticle and CitedPerson tables
    self.verify_citedArticles()
    # Validate response with ArticleAsset table
    self.verify_article_file(resources.PDF_CONTENT_TYPE, 'articlePdf')
    self.verify_article_file(resources.XML_CONTENT_TYPE, 'articleXml')
    self.verify_article_figures()
    self.verify_article_graphics()

  def test_zip_ingestion_force_false(self):
    """
    POST zips: Not forced ingestion of ZIP archive
    """
    print('\nTesting POST zips/ and not force reingest\n')
    # Ingest a ZIP file
    self.post_ingestible_zip(resources.ZIP_ARTICLE)
    # Validate HTTP code in the response is 201 (CREATED)
{'fraction_non_alphanumeric': 0.08146920740127037, 'fraction_numerical': 0.006075669704501519, 'mean_word_length': 4.009681881051176, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '4536328', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1114, 'n_words': 299}