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

"""
Base class for Rhino Journal JSON related services
"""

__author__ = '<EMAIL>'

from ...Base.base_service_test import BaseServiceTest
from ...Base.Config import API_BASE_URL
from ...Base.api import needs

JOURNALS_API = API_BASE_URL + '/journals'
DEFAULT_HEADERS = {'Accept': 'application/json'}
HEADER = '-H'
EXPECTED_KEYS = [u'PLoSBiology', u'PLoSPathogens', u'PLoSDefault', u'PLoSMedicine', u'PLoSNTD', u'PLoSCompBiol', u'PLoSCollections', u'PLoSClinicalTrials', u'PLoSGenetics', u'PLoSONE']


class JournalCCJson(BaseServiceTest):

  def get_journals(self):
    """
    Calls Rhino API to get journal list
    :param
    :return:JSON response
    """
    header = {'header': HEADER}
    self.doGet('%s' % JOURNALS_API, header, DEFAULT_HEADERS)
    self.parse_response_as_json()

  @needs('parsed', 'parse_response_as_json()')
  def verify_journals(self):
    """
    Verifies a valid response
    :param
    :return: Journal List + OK
    """
    print ('Validating journals...'),
    actual_keys = self.parsed.get_journalKey()
    assert actual_keys == EXPECTED_KEYS, 'Journals keys did not match: Actual Keys %s != Expected Keys %s' % (actual_keys, EXPECTED_KEYS)
    print ('OK')
<commit_msg>qa-reactive-fix-journal fixing journals integration test<commit_after>#!/usr/bin/env python2

"""
Base class for Rhino Journal JSON related services
"""

__author__ = '<EMAIL>'

from ...Base.base_service_test import BaseServiceTest
from ...Base.Config import API_BASE_URL
from ...Base.api import needs

JOURNALS_API = API_BASE_URL + '/journals'
DEFAULT_HEADERS = {'Accept': 'application/json'}
HEADER = '-H'
EXPECTED_KEYS = [u'PLoSMedicine', u'PLoSONE', u'PLoSGenetics', u'PLoSCompBiol', u'PLoSCollections', u'PLoSDefault', u'PLoSNTD', u'PLoSBiology', u'PLoSClinicalTrials', u'PLoSPathogens']


class JournalCCJson(BaseServiceTest):

  def get_journals(self):
    """
    Calls Rhino API to get journal list
    :param
    :return:JSON response
    """
    header = {'header': HEADER}
    self.doGet('%s' % JOURNALS_API, header, DEFAULT_HEADERS)
    self.parse_response_as_json()

  @needs('parsed', 'parse_response_as_json()')
  def verify_journals(self):
    """
    Verifies a valid response
    :param
    :return: Journal List + OK
    """
    print ('Validating journals...'),
    actual_keys = self.parsed.get_journalKey()
    assert actual_keys == EXPECTED_KEYS, 'Journals keys did not match: Actual Keys %s != Expected Keys %s' % (actual_keys, EXPECTED_KEYS)
    print ('OK')

{'fraction_non_alphanumeric': 0.13415116739216462, 'fraction_numerical': 0.0007914523149980214, 'mean_word_length': 4.471861471861472, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4879388', 'n_tokens_mistral': 895, 'n_tokens_neox': 858, 'n_words': 206}