예제 #1
0
 def test_07_canonicalise_error(self):
     epmc = EPMCPlugin()
     # create an invalid epmc and assert it is a epmc
     bjid = {"id" : "a;lkdsjfjdsajadskja", "type" : "epmc"}
     record = models.MessageObject(bid=bjid)
     with self.assertRaises(models.LookupException):
         epmc.canonicalise(record)
         
     bjid = {"key" : "value"}
     record = models.MessageObject(record={"identifier" : bjid})
     with self.assertRaises(models.LookupException):
         epmc.canonicalise(record)
예제 #2
0
 def test_05_canonicalise_real(self):
     epmc = EPMCPlugin()
     counter = 0
     for d in CANONICAL.keys():
         bjid = {'id' : d, 'type' : 'epmc'}
         record = models.MessageObject(bid=bjid)
         epmc.canonicalise(record)
         assert bjid.has_key("canonical")
         assert bjid["canonical"] == CANONICAL[d]
         counter += 1
     assert counter == len(CANONICAL.keys())
     assert counter > 0
예제 #3
0
 def test_06_canonicalise_ignore(self):
     epmc = EPMCPlugin()
     bjid = {"id" : "whatever", "type" : "doi"}
     record = models.MessageObject(bid=bjid)
     epmc.canonicalise(record)
     assert not bjid.has_key("canonical")