Esempio n. 1
0
    def test_ascl_deleted_citation_with_bibcode(self):
        citation_changes = adsmsg.CitationChanges()
        citation_change = citation_changes.changes.add()
        citation_change.citing = '2017AJ....153..114F'
        citation_change.cited = '2012ascl.soft03003C'
        citation_change.content = 'ascl:1203.003'
        citation_change.content_type = adsmsg.CitationChangeContentType.pid
        citation_change.resolved = True
        citation_change.status = adsmsg.Status.deleted
        expected_event_type = "relation_deleted"
        expected_original_relationship_name = "Cites"
        expected_source_bibcode = citation_change.citing
        expected_target_id = citation_change.content
        expected_target_id_schema = "ascl"
        expected_target_url = "https://ascl.net/{}".format(expected_target_id)
        expected_json_body = self._build_expected_json_body(
            expected_event_type, expected_original_relationship_name,
            expected_source_bibcode, expected_target_id,
            expected_target_id_schema, expected_target_url)

        event_data = webhook.citation_change_to_event_data(citation_change)
        emitted = webhook.emit_event(self.app.conf['ADS_WEBHOOK_URL'],
                                     self.app.conf['ADS_WEBHOOK_AUTH_TOKEN'],
                                     event_data,
                                     timeout=30)
        self.assertFalse(
            emitted,
            "Agreed citation change was NOT assigned to an agreed event")
Esempio n. 2
0
    def test_doi_deleted_citation_with_bibcode(self):
        citation_changes = adsmsg.CitationChanges()
        citation_change = citation_changes.changes.add()
        citation_change.citing = '2000JMP....41.1788O'
        citation_change.cited = '1990JMP....31..316D'
        citation_change.content = '10.1063/1.528916'
        citation_change.content_type = adsmsg.CitationChangeContentType.doi
        citation_change.resolved = True
        citation_change.status = adsmsg.Status.deleted
        expected_event_type = "relation_deleted"
        expected_original_relationship_name = "Cites"
        expected_source_bibcode = citation_change.citing
        expected_target_id = citation_change.content
        expected_target_id_schema = "doi"
        expected_target_url = "https://doi.org/{}".format(expected_target_id)
        expected_json_body = self._build_expected_json_body(
            expected_event_type, expected_original_relationship_name,
            expected_source_bibcode, expected_target_id,
            expected_target_id_schema, expected_target_url)

        event_data = webhook.citation_change_to_event_data(
            citation_change, expected_json_body)
        emitted = webhook.emit_event(self.app.conf['ADS_WEBHOOK_URL'],
                                     self.app.conf['ADS_WEBHOOK_AUTH_TOKEN'],
                                     event_data,
                                     timeout=30)
        self.assertTrue(
            emitted,
            "Agreed citation change was NOT assigned to an agreed event")
        request = httpretty.last_request()
        self._assert_request(request, expected_json_body)
    def test_doi_new_citation(self):
        citation_changes = adsmsg.CitationChanges()
        citation_change = citation_changes.changes.add()
        citation_change.citing = '2005CaJES..42.1987P'
        citation_change.cited = '...................'
        citation_change.content = '10.1016/0277-3791'
        citation_change.content_type = adsmsg.CitationChangeContentType.doi
        citation_change.resolved = False
        citation_change.status = adsmsg.Status.new
        expected_event_type = "relation_created"
        expected_original_relationship_name = "Cites"
        expected_source_bibcode = citation_change.citing
        expected_target_id = citation_change.content
        expected_target_id_schema = u"DOI"
        expected_target_url = "https://doi.org"
        expected_json_body = self._build_expected_json_body(
            expected_event_type, expected_original_relationship_name,
            expected_source_bibcode, expected_target_id,
            expected_target_id_schema, expected_target_url)

        event_data = webhook.citation_change_to_event_data(citation_change)
        emitted = webhook.emit_event(self.app.conf['ADS_WEBHOOK_URL'],
                                     self.app.conf['ADS_WEBHOOK_AUTH_TOKEN'],
                                     event_data,
                                     timeout=30)
        self.assertTrue(
            emitted,
            "Agreed citation change was NOT assigned to an agreed event")
        request = httpretty.last_request()
        self._assert_request(request, expected_json_body)
    def test_url_new_citation_with_bibcode(self):
        citation_changes = adsmsg.CitationChanges()
        citation_change = citation_changes.changes.add()
        citation_change.citing = '2017arXiv170305698M'
        citation_change.cited = '2017iagt.conf.2017G'
        citation_change.content = 'http://www.github.com/capergroup/bayou'
        citation_change.content_type = adsmsg.CitationChangeContentType.url
        citation_change.resolved = True
        citation_change.status = adsmsg.Status.new
        expected_event_type = "relation_created"
        expected_original_relationship_name = "Cites"
        expected_source_bibcode = citation_change.citing
        expected_target_id = citation_change.content
        expected_target_id_schema = u"URL"
        expected_target_url = citation_change.content
        expected_json_body = self._build_expected_json_body(
            expected_event_type, expected_original_relationship_name,
            expected_source_bibcode, expected_target_id,
            expected_target_id_schema, expected_target_url)

        event_data = webhook.citation_change_to_event_data(citation_change)
        emitted = webhook.emit_event(self.app.conf['ADS_WEBHOOK_URL'],
                                     self.app.conf['ADS_WEBHOOK_AUTH_TOKEN'],
                                     event_data,
                                     timeout=30)
        self.assertTrue(
            emitted,
            "Agreed citation change was NOT assigned to an agreed event")
        request = httpretty.last_request()
        self._assert_request(request, expected_json_body)
    def test_url_updated_citation_with_bibcode(self):
        citation_changes = adsmsg.CitationChanges()
        citation_change = citation_changes.changes.add()
        citation_change.citing = '2016NatSR...637369S'
        citation_change.cited = '2012JOSS...61..539R'  # previous_cited 2012ASSL..304..539R
        citation_change.content = 'http://mrbayes.sourceforge.net/'
        citation_change.content_type = adsmsg.CitationChangeContentType.url
        citation_change.resolved = True
        citation_change.status = adsmsg.Status.updated
        expected_event_type = "relation_created"
        expected_original_relationship_name = "IsIdenticalTo"
        expected_source_bibcode = citation_change.cited
        expected_target_id = citation_change.content
        expected_target_id_schema = u"URL"
        expected_target_url = citation_change.content
        expected_json_body = self._build_expected_json_body(
            expected_event_type, expected_original_relationship_name,
            expected_source_bibcode, expected_target_id,
            expected_target_id_schema, expected_target_url)

        event_data = webhook.citation_change_to_event_data(citation_change)
        emitted = webhook.emit_event(self.app.conf['ADS_WEBHOOK_URL'],
                                     self.app.conf['ADS_WEBHOOK_AUTH_TOKEN'],
                                     event_data,
                                     timeout=30)
        self.assertFalse(
            emitted,
            "Agreed citation change was NOT assigned to an agreed event")
    def test_ascl_new_citation_with_bibcode(self):
        citation_changes = adsmsg.CitationChanges()
        citation_change = citation_changes.changes.add()
        citation_change.citing = '2017A&A...603A.117S'
        citation_change.cited = '2011ascl.soft06002P'
        citation_change.content = 'ascl:1106.002'
        citation_change.content_type = adsmsg.CitationChangeContentType.pid
        citation_change.resolved = True
        citation_change.status = adsmsg.Status.new
        expected_event_type = "relation_created"
        expected_original_relationship_name = "Cites"
        expected_source_bibcode = citation_change.citing
        expected_target_id = citation_change.content
        expected_target_id_schema = u"ASCL"
        expected_target_url = "http://ascl.net/"
        expected_json_body = self._build_expected_json_body(
            expected_event_type, expected_original_relationship_name,
            expected_source_bibcode, expected_target_id,
            expected_target_id_schema, expected_target_url)

        event_data = webhook.citation_change_to_event_data(citation_change)
        emitted = webhook.emit_event(self.app.conf['ADS_WEBHOOK_URL'],
                                     self.app.conf['ADS_WEBHOOK_AUTH_TOKEN'],
                                     event_data,
                                     timeout=30)
        self.assertTrue(
            emitted,
            "Agreed citation change was NOT assigned to an agreed event")
        request = httpretty.last_request()
        self._assert_request(request, expected_json_body)
    def test_ascl_deleted_citation(self):
        citation_changes = adsmsg.CitationChanges()
        citation_change = citation_changes.changes.add()
        citation_change.citing = ''
        citation_change.cited = '...................'
        citation_change.content = ''
        citation_change.content_type = adsmsg.CitationChangeContentType.pid
        citation_change.resolved = False
        citation_change.status = adsmsg.Status.deleted
        expected_event_type = "relation_deleted"
        expected_original_relationship_name = "Cites"
        expected_source_bibcode = citation_change.citing
        expected_target_id = citation_change.content
        expected_target_id_schema = u"ASCL"
        expected_target_url = "http://ascl.net/"
        expected_json_body = self._build_expected_json_body(
            expected_event_type, expected_original_relationship_name,
            expected_source_bibcode, expected_target_id,
            expected_target_id_schema, expected_target_url)

        event_data = webhook.citation_change_to_event_data(citation_change)
        emitted = webhook.emit_event(self.app.conf['ADS_WEBHOOK_URL'],
                                     self.app.conf['ADS_WEBHOOK_AUTH_TOKEN'],
                                     event_data,
                                     timeout=30)
        self.assertFalse(
            emitted,
            "Agreed citation change was NOT assigned to an agreed event")
    def test_doi_updated_citation_with_bibcode(self):
        citation_changes = adsmsg.CitationChanges()
        citation_change = citation_changes.changes.add()
        citation_change.citing = '1998CP....232..343L'
        citation_change.content = '1991SPIE.1361.1048S'
        citation_change.content_type = adsmsg.CitationChangeContentType.doi
        citation_change.resolved = True
        citation_change.status = adsmsg.Status.updated
        expected_event_type = "relation_created"
        expected_original_relationship_name = "IsIdenticalTo"
        expected_source_bibcode = citation_change.cited
        expected_target_id = citation_change.content
        expected_target_id_schema = u"DOI"
        expected_target_url = "https://doi.org"
        expected_json_body = self._build_expected_json_body(
            expected_event_type, expected_original_relationship_name,
            expected_source_bibcode, expected_target_id,
            expected_target_id_schema, expected_target_url)

        event_data = webhook.citation_change_to_event_data(citation_change)
        emitted = webhook.emit_event(self.app.conf['ADS_WEBHOOK_URL'],
                                     self.app.conf['ADS_WEBHOOK_AUTH_TOKEN'],
                                     event_data,
                                     timeout=30)
        self.assertFalse(
            emitted,
            "Agreed citation change was NOT assigned to an agreed event")
Esempio n. 9
0
 def test_url_updated_citation(self):
     citation_changes = adsmsg.CitationChanges()
     citation_change = citation_changes.changes.add()
     citation_change.citing = '2016CMAME.305..579P'
     citation_change.cited = '...................'  # previous_cited 2015LIACo...3....2T
     citation_change.content = 'https://github.com/su2code/TestCases'
     citation_change.content_type = adsmsg.CitationChangeContentType.url
     citation_change.resolved = False
     citation_change.status = adsmsg.Status.updated
     is_link_alive = False
     license_info = {
         'license_url': 'https://creativecommons.org/publicdomain/zero/1.0/'
     }
     parsed_metadata = {
         'link_alive': is_link_alive,
         "doctype": "software",
         'license_name': license_info.get('license_name', ""),
         'license_url': license_info.get('license_url', "")
     }
     event_data = webhook.citation_change_to_event_data(
         citation_change, parsed_metadata)
     emitted = webhook.emit_event(self.app.conf['ADS_WEBHOOK_URL'],
                                  self.app.conf['ADS_WEBHOOK_AUTH_TOKEN'],
                                  event_data,
                                  timeout=30)
     self.assertFalse(
         emitted,
         "Non-agreed citation change was assigned to an agreed event")
Esempio n. 10
0
 def test_ascl_updated_citation(self):
     citation_changes = adsmsg.CitationChanges()
     citation_change = citation_changes.changes.add()
     citation_change.citing = '2013MNRAS.432.1658C'
     citation_change.cited = '...................'  # previous_cited 2012ascl.soft05004P
     citation_change.content = 'ascl:1205.004'
     citation_change.content_type = adsmsg.CitationChangeContentType.pid
     citation_change.resolved = False
     citation_change.status = adsmsg.Status.updated
     is_link_alive = False
     license_info = {
         'license_url': 'https://creativecommons.org/publicdomain/zero/1.0/'
     }
     parsed_metadata = {
         'link_alive': is_link_alive,
         "doctype": "software",
         'license_name': license_info.get('license_name', ""),
         'license_url': license_info.get('license_url', "")
     }
     event_data = webhook.citation_change_to_event_data(
         citation_change, parsed_metadata)
     emitted = webhook.emit_event(self.app.conf['ADS_WEBHOOK_URL'],
                                  self.app.conf['ADS_WEBHOOK_AUTH_TOKEN'],
                                  event_data,
                                  timeout=30)
     self.assertFalse(
         emitted,
         "Non-agreed citation change was assigned to an agreed event")
Esempio n. 11
0
 def test_doi_updated_citation(self):
     citation_changes = adsmsg.CitationChanges()
     citation_change = citation_changes.changes.add()
     citation_change.citing = '1999ITGRS..37..917L'
     citation_change.cited = '...................'  # previous_cited 1997ASAJ..101Q3182L
     citation_change.content = '10.1121/1.419176'
     citation_change.content_type = adsmsg.CitationChangeContentType.doi
     citation_change.resolved = False
     citation_change.status = adsmsg.Status.updated
     is_link_alive = False
     license_info = {
         'license_url': 'https://creativecommons.org/publicdomain/zero/1.0/'
     }
     parsed_metadata = {
         'link_alive': is_link_alive,
         "doctype": "software",
         'license_name': license_info.get('license_name', ""),
         'license_url': license_info.get('license_url', "")
     }
     event_data = webhook.citation_change_to_event_data(
         citation_change, parsed_metadata)
     emitted = webhook.emit_event(self.app.conf['ADS_WEBHOOK_URL'],
                                  self.app.conf['ADS_WEBHOOK_AUTH_TOKEN'],
                                  event_data,
                                  timeout=30)
     self.assertFalse(
         emitted,
         "Non-agreed citation change was assigned to an agreed event")
Esempio n. 12
0
 def test_url_updated_citation(self):
     citation_changes = adsmsg.CitationChanges()
     citation_change = citation_changes.changes.add()
     citation_change.citing = '2016CMAME.305..579P'
     citation_change.cited = '...................' # previous_cited 2015LIACo...3....2T
     citation_change.content = 'https://github.com/su2code/TestCases'
     citation_change.content_type = adsmsg.CitationChangeContentType.url
     citation_change.resolved = False
     citation_change.status = adsmsg.Status.updated
     event_data = webhook.citation_change_to_event_data(citation_change)
     emitted = webhook.emit_event(self.app.conf['ADS_WEBHOOK_URL'], self.app.conf['ADS_WEBHOOK_AUTH_TOKEN'], event_data, timeout=30)
     self.assertFalse(emitted, "Non-agreed citation change was assigned to an agreed event")
Esempio n. 13
0
    def test_ascl_updated_citation(self):
        citation_changes = adsmsg.CitationChanges()
        citation_change = citation_changes.changes.add()
        citation_change.citing = '2013MNRAS.432.1658C'
        citation_change.cited = '...................' # previous_cited 2012ascl.soft05004P
        citation_change.content = 'ascl:1205.004'
        citation_change.content_type = adsmsg.CitationChangeContentType.pid
        citation_change.resolved = False
        citation_change.status = adsmsg.Status.updated

        event_data = webhook.citation_change_to_event_data(citation_change)
        emitted = webhook.emit_event(self.app.conf['ADS_WEBHOOK_URL'], self.app.conf['ADS_WEBHOOK_AUTH_TOKEN'], event_data, timeout=30)
        self.assertFalse(emitted, "Non-agreed citation change was assigned to an agreed event")
Esempio n. 14
0
    def test_doi_updated_citation(self):
        citation_changes = adsmsg.CitationChanges()
        citation_change = citation_changes.changes.add()
        citation_change.citing = '1999ITGRS..37..917L'
        citation_change.cited = '...................' # previous_cited 1997ASAJ..101Q3182L
        citation_change.content = '10.1121/1.419176'
        citation_change.content_type = adsmsg.CitationChangeContentType.doi
        citation_change.resolved = False
        citation_change.status = adsmsg.Status.updated

        event_data = webhook.citation_change_to_event_data(citation_change)
        emitted = webhook.emit_event(self.app.conf['ADS_WEBHOOK_URL'], self.app.conf['ADS_WEBHOOK_AUTH_TOKEN'], event_data, timeout=30)
        self.assertFalse(emitted, "Non-agreed citation change was assigned to an agreed event")
Esempio n. 15
0
def _emit_citation_change(citation_change, parsed_metadata):
    """
    Emit citation change event if the target is a software record
    """
    is_link_alive = parsed_metadata and parsed_metadata.get(
        "link_alive", False)
    is_software = parsed_metadata and parsed_metadata.get(
        "doctype", "").lower() == "software"
    if is_software and is_link_alive:
        event_data = webhook.citation_change_to_event_data(citation_change)
        if event_data:
            dump_prefix = citation_change.timestamp.ToDatetime().strftime(
                "%Y%m%d_%H%M%S")
            logger.debug("Calling 'task_emit_event' for '%s'", citation_change)
            task_emit_event.delay(event_data, dump_prefix)
Esempio n. 16
0
 def test_doi_new_citation(self):
     citation_changes = adsmsg.CitationChanges()
     citation_change = citation_changes.changes.add()
     citation_change.citing = '2005CaJES..42.1987P'
     citation_change.cited = '...................'
     citation_change.content = '10.1016/0277-3791'
     citation_change.content_type = adsmsg.CitationChangeContentType.doi
     citation_change.resolved = False
     citation_change.status = adsmsg.Status.new
     expected_event_type = "relation_created"
     expected_original_relationship_name = "Cites"
     expected_source_bibcode = citation_change.citing
     expected_target_id = citation_change.content
     expected_target_id_schema = "doi"
     expected_target_url = "https://doi.org/{}".format(expected_target_id)
     is_link_alive = True
     license_info = {
         'license_url': 'https://creativecommons.org/publicdomain/zero/1.0/'
     }
     parsed_metadata = {
         'link_alive': is_link_alive,
         "doctype": "software",
         'license_name': license_info.get('license_name', ""),
         'license_url': license_info.get('license_url', "")
     }
     expected_json_body = self._build_expected_json_body(
         expected_event_type, expected_original_relationship_name,
         expected_source_bibcode, expected_target_id,
         expected_target_id_schema, expected_target_url,
         parsed_metadata.get('doctype', ""),
         parsed_metadata.get('license_url', ""))
     event_data = webhook.citation_change_to_event_data(
         citation_change, parsed_metadata)
     emitted = webhook.emit_event(self.app.conf['ADS_WEBHOOK_URL'],
                                  self.app.conf['ADS_WEBHOOK_AUTH_TOKEN'],
                                  event_data,
                                  timeout=30)
     self.assertTrue(
         emitted,
         "Agreed citation change was NOT assigned to an agreed event")
     request = httpretty.last_request()
     self._assert_request(request, expected_json_body)
Esempio n. 17
0
 def test_url_new_citation_with_bibcode(self):
     citation_changes = adsmsg.CitationChanges()
     citation_change = citation_changes.changes.add()
     citation_change.citing = '2017arXiv170305698M'
     citation_change.cited = '2017iagt.conf.2017G'
     citation_change.content = 'http://www.github.com/capergroup/bayou'
     citation_change.content_type = adsmsg.CitationChangeContentType.url
     citation_change.resolved = True
     citation_change.status = adsmsg.Status.new
     expected_event_type = "relation_created"
     expected_original_relationship_name = "Cites"
     expected_source_bibcode = citation_change.citing
     expected_target_id = citation_change.content
     expected_target_id_schema = "url"
     expected_target_url = citation_change.content
     is_link_alive = True
     license_info = {
         'license_url': 'https://creativecommons.org/publicdomain/zero/1.0/'
     }
     parsed_metadata = {
         'link_alive': is_link_alive,
         "doctype": "software",
         'license_name': license_info.get('license_name', ""),
         'license_url': license_info.get('license_url', "")
     }
     expected_json_body = self._build_expected_json_body(
         expected_event_type, expected_original_relationship_name,
         expected_source_bibcode, expected_target_id,
         expected_target_id_schema, expected_target_url,
         parsed_metadata.get('doctype', ""),
         parsed_metadata.get('license_url', ""))
     event_data = webhook.citation_change_to_event_data(
         citation_change, parsed_metadata)
     emitted = webhook.emit_event(self.app.conf['ADS_WEBHOOK_URL'],
                                  self.app.conf['ADS_WEBHOOK_AUTH_TOKEN'],
                                  event_data,
                                  timeout=30)
     self.assertTrue(
         emitted,
         "Agreed citation change was NOT assigned to an agreed event")
     request = httpretty.last_request()
     self._assert_request(request, expected_json_body)
Esempio n. 18
0
 def test_url_updated_citation_with_bibcode(self):
     citation_changes = adsmsg.CitationChanges()
     citation_change = citation_changes.changes.add()
     citation_change.citing = '2016NatSR...637369S'
     citation_change.cited = '2012JOSS...61..539R'  # previous_cited 2012ASSL..304..539R
     citation_change.content = 'http://mrbayes.sourceforge.net/'
     citation_change.content_type = adsmsg.CitationChangeContentType.url
     citation_change.resolved = True
     citation_change.status = adsmsg.Status.updated
     expected_event_type = "relation_created"
     expected_original_relationship_name = "IsIdenticalTo"
     expected_source_bibcode = citation_change.cited
     expected_target_id = citation_change.content
     expected_target_id_schema = "url"
     expected_target_url = citation_change.content
     is_link_alive = True
     license_info = {
         'license_url': 'https://creativecommons.org/publicdomain/zero/1.0/'
     }
     parsed_metadata = {
         'link_alive': is_link_alive,
         "doctype": "software",
         'license_name': license_info.get('license_name', ""),
         'license_url': license_info.get('license_url', "")
     }
     expected_json_body = self._build_expected_json_body(
         expected_event_type, expected_original_relationship_name,
         expected_source_bibcode, expected_target_id,
         expected_target_id_schema, expected_target_url,
         parsed_metadata.get('doctype', ""),
         parsed_metadata.get('license_url', ""))
     event_data = webhook.citation_change_to_event_data(
         citation_change, parsed_metadata)
     emitted = webhook.emit_event(self.app.conf['ADS_WEBHOOK_URL'],
                                  self.app.conf['ADS_WEBHOOK_AUTH_TOKEN'],
                                  event_data,
                                  timeout=30)
     self.assertFalse(
         emitted,
         "Agreed citation change was NOT assigned to an agreed event")
Esempio n. 19
0
    def test_url_new_citation(self):
        citation_changes = adsmsg.CitationChanges()
        citation_change = citation_changes.changes.add()
        citation_change.citing = '2017arXiv170610086M'
        citation_change.cited = '...................'
        citation_change.content = 'https://github.com/ComputationalRadiationPhysics/graybat'
        citation_change.content_type = adsmsg.CitationChangeContentType.url
        citation_change.resolved = False
        citation_change.status = adsmsg.Status.new
        expected_event_type = "relation_created"
        expected_original_relationship_name = "Cites"
        expected_source_bibcode = citation_change.citing
        expected_target_id = citation_change.content
        expected_target_id_schema = u"url"
        expected_target_url = citation_change.content
        expected_json_body = self._build_expected_json_body(expected_event_type, expected_original_relationship_name, expected_source_bibcode, expected_target_id, expected_target_id_schema, expected_target_url)

        event_data = webhook.citation_change_to_event_data(citation_change)
        emitted = webhook.emit_event(self.app.conf['ADS_WEBHOOK_URL'], self.app.conf['ADS_WEBHOOK_AUTH_TOKEN'], event_data, timeout=30)
        self.assertTrue(emitted, "Agreed citation change was NOT assigned to an agreed event")
        request = httpretty.last_request()
        self._assert_request(request, expected_json_body)
Esempio n. 20
0
 def test_doi_updated_citation_with_bibcode(self):
     citation_changes = adsmsg.CitationChanges()
     citation_change = citation_changes.changes.add()
     citation_change.citing = '1998CP....232..343L'
     citation_change.content = '1991SPIE.1361.1048S'
     citation_change.content_type = adsmsg.CitationChangeContentType.doi
     citation_change.resolved = True
     citation_change.status = adsmsg.Status.updated
     expected_event_type = "relation_created"
     expected_original_relationship_name = "IsIdenticalTo"
     expected_source_bibcode = citation_change.cited
     expected_target_id = citation_change.content
     expected_target_id_schema = "doi"
     expected_target_url = "https://doi.org/{}".format(expected_target_id)
     is_link_alive = True
     license_info = {
         'license_url': 'https://creativecommons.org/publicdomain/zero/1.0/'
     }
     parsed_metadata = {
         'link_alive': is_link_alive,
         "doctype": "software",
         'license_name': license_info.get('license_name', ""),
         'license_url': license_info.get('license_url', "")
     }
     expected_json_body = self._build_expected_json_body(
         expected_event_type, expected_original_relationship_name,
         expected_source_bibcode, expected_target_id,
         expected_target_id_schema, expected_target_url,
         parsed_metadata.get('doctype', ""),
         parsed_metadata.get('license_url', ""))
     event_data = webhook.citation_change_to_event_data(
         citation_change, parsed_metadata)
     emitted = webhook.emit_event(self.app.conf['ADS_WEBHOOK_URL'],
                                  self.app.conf['ADS_WEBHOOK_AUTH_TOKEN'],
                                  event_data,
                                  timeout=30)
     self.assertFalse(
         emitted,
         "Agreed citation change was NOT assigned to an agreed event")
Esempio n. 21
0
 def test_ascl_deleted_citation(self):
     citation_changes = adsmsg.CitationChanges()
     citation_change = citation_changes.changes.add()
     citation_change.citing = ''
     citation_change.cited = '...................'
     citation_change.content = ''
     citation_change.content_type = adsmsg.CitationChangeContentType.pid
     citation_change.resolved = False
     citation_change.status = adsmsg.Status.deleted
     expected_event_type = "relation_deleted"
     expected_original_relationship_name = "Cites"
     expected_source_bibcode = citation_change.citing
     expected_target_id = citation_change.content
     expected_target_id_schema = "ascl"
     expected_target_url = "https://ascl.net/{}".format(expected_target_id)
     is_link_alive = True
     license_info = {
         'license_url': 'https://creativecommons.org/publicdomain/zero/1.0/'
     }
     parsed_metadata = {
         'link_alive': is_link_alive,
         "doctype": "software",
         'license_name': license_info.get('license_name', ""),
         'license_url': license_info.get('license_url', "")
     }
     expected_json_body = self._build_expected_json_body(
         expected_event_type, expected_original_relationship_name,
         expected_source_bibcode, expected_target_id,
         expected_target_id_schema, expected_target_url,
         parsed_metadata.get('doctype', ""),
         parsed_metadata.get('license_url', ""))
     event_data = webhook.citation_change_to_event_data(citation_change)
     emitted = webhook.emit_event(self.app.conf['ADS_WEBHOOK_URL'],
                                  self.app.conf['ADS_WEBHOOK_AUTH_TOKEN'],
                                  event_data,
                                  timeout=30)
     self.assertFalse(
         emitted,
         "Agreed citation change was NOT assigned to an agreed event")