Esempio n. 1
0
    def test_search_journal_issn_with_journal(self, mock_urlopen):
        mock_urlopen.return_value.read.return_value = \
                self.fixture_text('example-06.xml')

        journal = romeo.search_journal_issn('0013-1245')
        publisher = journal.publisher_details()

        # query
        mock_urlopen.assert_called_once()
        args, kwargs = mock_urlopen.call_args
        self.assertEqual(kwargs, {})
        self.assertEqual(len(args), 1)
        query_args = parse_qs(urlsplit(args[0]).query)
        self.assertEqual(query_args['issn'], ['0013-1245'])

        # response
        self.assertEqual(journal.title, 'Education and Urban Society')
        self.assertEqual(journal.issn, '0013-1245')
        self.assertTrue(isinstance(publisher, romeo.Publisher))
        self.assertEqual(publisher.name, 'SAGE Publications')
        # also some publisher fields we haven't seen before
        self.assertEqual(len(publisher.postprint_restrictions), 1)
        self.assertEqual(
            publisher.postprint_restrictions[0],
            '<num>12</num> <period units="month">months</period> embargo')
Esempio n. 2
0
    def test_search_journal_issn_no_publisher(self, mock_urlopen):
        mock_urlopen.return_value.read.return_value = \
                self.fixture_text('example-07.xml')

        journal = romeo.search_journal_issn('0004-9158')

        # query
        mock_urlopen.assert_called_once()
        args, kwargs = mock_urlopen.call_args
        self.assertEqual(kwargs, {})
        self.assertEqual(len(args), 1)
        query_args = parse_qs(urlsplit(args[0]).query)
        self.assertEqual(query_args['issn'], ['0004-9158'])

        # response
        self.assertEqual(journal.title, 'Australian Forestry')
        self.assertEqual(journal.issn, '0004-9158')
        self.assertFalse(journal.response_includes_publisher_details())
Esempio n. 3
0
    def test_search_journal_issn_no_publisher(self, mock_urlopen):
        mock_urlopen.return_value.read.return_value = \
                self.fixture_text('example-07.xml')

        journal = romeo.search_journal_issn('0004-9158')

        # query
        mock_urlopen.assert_called_once()
        args, kwargs = mock_urlopen.call_args
        self.assertEqual(kwargs, {})
        self.assertEqual(len(args), 1)
        query_args = parse_qs(urlsplit(args[0]).query)
        self.assertEqual(query_args['issn'], ['0004-9158'])

        # response
        self.assertEqual(journal.title, 'Australian Forestry')
        self.assertEqual(journal.issn, '0004-9158')
        self.assertFalse(journal.response_includes_publisher_details())
Esempio n. 4
0
    def test_search_journal_issn_with_journal(self, mock_urlopen):
        mock_urlopen.return_value.read.return_value = \
                self.fixture_text('example-06.xml')

        journal = romeo.search_journal_issn('0013-1245')
        publisher = journal.publisher_details()

        # query
        mock_urlopen.assert_called_once()
        args, kwargs = mock_urlopen.call_args
        self.assertEqual(kwargs, {})
        self.assertEqual(len(args), 1)
        query_args = parse_qs(urlsplit(args[0]).query)
        self.assertEqual(query_args['issn'], ['0013-1245'])

        # response
        self.assertEqual(journal.title, 'Education and Urban Society')
        self.assertEqual(journal.issn, '0013-1245')
        self.assertTrue(isinstance(publisher, romeo.Publisher))
        self.assertEqual(publisher.name, 'SAGE Publications')
        # also some publisher fields we haven't seen before
        self.assertEqual(len(publisher.postprint_restrictions), 1)
        self.assertEqual(publisher.postprint_restrictions[0],
                '<num>12</num> <period units="month">months</period> embargo')