Пример #1
0
 def test_doi_is_resolved_unresolved(self):
     """
     Querying crossfer using a unregistered DOI number
     """
     doi = Brocker()
     is_resolved = doi.is_resolved("10.1590/S2179-975X20120050XXXXX")
     self.assertEqual(is_resolved, False)
Пример #2
0
 def test_doi_request_unparsed_xml(self):
     """
     Requesting a DOI number passing a unparseable xml
     """
     doi = Brocker(xsd='../xsd/crossref4.3.1.xsd')
     self.assertRaises(XMLSyntaxError,
                       lambda: doi.request(xml=datasample.wrong_query_xml))
Пример #3
0
 def test_query_doi_is_resolved_wrong_api_url(self):
     """
     Testing the is_resolved method using an invalid url
     """
     doi = Brocker(crossref_api_url='http://wrongurl.crossref.org/servlet/query')
     self.assertRaises(URLError,
                       lambda: doi.is_resolved("10.1590/S2179-975X2012005000002"))
Пример #4
0
 def test_query_doi_is_resolved_query_email(self):
     """
     Testing the is_resolved method using an invalid email
     """
     doi = Brocker(query_email='*****@*****.**')
     self.assertRaises(HTTPError,
                       lambda: doi.is_resolved("10.1590/S2179-975X2012005000002"))
Пример #5
0
 def test_query_doi_unparsed_xml(self):
     """
     Querying crossfer for a DOI number with an unparsed xml
     """
     doi = Brocker()
     self.assertRaises(XMLSyntaxError,
                       lambda: doi.query_doi(xml=datasample.wrong_query_xml))
Пример #6
0
 def test_query_doi_invalid_xml(self):
     """
     Querying crossfer for a DOI number with invalid xml validated against schema
     """
     doi = Brocker()
     query_doi = doi.query_doi(xml=datasample.invalid_query_xml)
     self.assertEqual(query_doi, None)
Пример #7
0
 def test_query_doi_invalid_query_email(self):
     """
     Testing the query_doi method using an invalid query e-mail
     """
     doi = Brocker(query_email='*****@*****.**')
     self.assertRaises(HTTPError,
                       lambda: doi.query_doi(xml=datasample.doc_without_doi))
Пример #8
0
 def test_query_doi_invalid_api_url(self):
     """
     Testing the query_doi method using an invalid URL
     """
     doi = Brocker(query_email='http://wrongurl.crossref.org/servlet/query')
     self.assertRaises(URLError,
                       lambda: doi.query_doi(xml=datasample.doc_without_doi))
Пример #9
0
 def test_doi_request_valid_xml(self):
     """
     Requesting a DOI number
     """
     doi = Brocker(xsd='../xsd/crossref4.3.1.xsd')
     result = doi.request(xml=datasample.valid_request_xml)
     self.assertEquals(result, True)
Пример #10
0
 def test_doi_request_invalid_xml(self):
     """
     Requesting a DOI number passing a ivalid xml according to the
     deposit schema http://www.crossref.org/schema/deposit/crossref4.3.1.xsd
     """
     doi = Brocker(xsd='../xsd/crossref4.3.1.xsd')
     self.assertEquals(None, doi.request(xml=datasample.invalid_query_xml))
Пример #11
0
 def test_query_doi_true(self):
     """
     Querying crossfer for a DOI number accoding to a document metadata that
     already have a DOI number registered
     """
     doi = Brocker()
     query_doi = doi.query_doi(xml=datasample.doc_with_doi)
     self.assertEqual(query_doi, "10.1590/S2179-975X2012005000002")
Пример #12
0
 def test_query_doi_false(self):
     """
     Querying crossfer for a DOI number accoding to a document metadata that
     does not have a DOI number registed
     """
     doi = Brocker()
     query_doi = doi.query_doi(xml=datasample.doc_without_doi)
     self.assertEqual(query_doi, None)
Пример #13
0
 def test_doi_request_valid_xml_wrong_login(self):
     """
     Requesting a DOI number with an invalid username and/or password
     """
     doi = Brocker(xsd='../xsd/crossref4.3.1.xsd', user='******', passwd='xxx')
     self.assertRaises(HTTPError, lambda: doi.request(xml=datasample.valid_request_xml))