Пример #1
0
    def __init__(self, collection, issns=None, output_file=None):

        self._articlemeta = utils.articlemeta_server()
        self.collection = collection
        self.doaj_journals = Journals()
        self.issns = issns
        self.output_file = codecs.open(output_file, 'w', encoding='utf-8') if output_file else output_file
        header = [u"coleção",u"issn scielo",u"issn impresso",u"issn eletrônico",u"título",u"ID no DOAJ",u"Provider no DOAJ",u"Status no DOAJ"]

        self.write(u','.join([u'"%s"' % i.replace(u'"', u'""') for i in header]))
Пример #2
0
class JournalsTest(unittest.TestCase):

    def setUp(self):
        self.jn = Journals()

    def test_get_journal(self):
        response = self.jn.get('022bf3ad951c4c5fa77a8279a59c437e')

        self.assertTrue('bibjson' in response)

    def test_get_journal_not_available(self):
        response = self.jn.get('not available')

        self.assertEqual(response['status'], 'not_found')

    def test_search_invalid_page_size(self):
        
        with self.assertRaises(ValueError):
            [x for x in self.jn.search('issn:1806-9940', pagesize='invalid')]

    def test_search_invalid_page_size_1(self):
        """
        not between 10 and 100.
        """
        with self.assertRaises(ValueError):
            [x for x in self.jn.search('issn:1806-9940', pagesize=9)]

    def test_search_invalid_page_size_2(self):
        """
        not between 10 and 100.
        """
        with self.assertRaises(ValueError):
            [x for x in self.jn.search('issn:1806-9940', pagesize=101)]

    def test_search(self):

        journals = [x for x in self.jn.search('id:022bf3ad951c4c5fa77a8279a59c437e')]

        self.assertEqual(1, len(journals))
Пример #3
0
 def setUp(self):
     self.jn = Journals()