Ejemplo n.º 1
0
 def testQDCE_extended_term_save(self):
     '''Test the saving of an extended term from the DCTERMS'''
     q=QualifiedDublinCoreElement()
     q.term = 'RH'
     q.content = 'XXXXX  TEXT XXXXX'
     q.object_id = 9
     q.content_type = ContentType.objects.get(app_label='auth', model='user')
     self.assertRaises(ValueError, q.save)
     q.term = 'T'
     q.save()
Ejemplo n.º 2
0
 def testQDCE_extended_term_save(self):
     '''Test the saving of an extended term from the DCTERMS'''
     q=QualifiedDublinCoreElement()
     q.term = 'RH'
     q.content = 'XXXXX  TEXT XXXXX'
     q.object_id = 9
     q.content_type = ContentType.objects.get(app_label='auth', model='user')
     self.assertRaises(ValueError, q.save)
     q.term = 'T'
     q.save()
Ejemplo n.º 3
0
 def testQDublinCoreElementNewHistory(self):
     '''Create a QualifiedDublinCoreElement, save it. No history yet.
     '''
     dct = QualifiedDublinCoreElement()
     dct.content_object = User.objects.get(pk=1)
     dct.term = 'T'
     dct.content = 'X'
     dct.save()
     self.failUnless(len(dct.history.all()) == 0)
     dct.content = 'Y'
     dct.save()
     self.failUnless(len(dct.history.all()) == 1)
Ejemplo n.º 4
0
 def testQDublinCoreElementNewHistory(self):
     '''Create a QualifiedDublinCoreElement, save it. No history yet.
     '''
     dct = QualifiedDublinCoreElement()
     dct.content_object = User.objects.get(pk=1)
     dct.term = 'T'
     dct.content = 'X'
     dct.save()
     self.failUnless(len(dct.history.all()) == 0)
     dct.content = 'Y'
     dct.save()
     self.failUnless(len(dct.history.all()) == 1)
Ejemplo n.º 5
0
 def testTermsGrouped(self):
     ''' Test that the DC for an object is grouped by the term type
     ie all subject terms come in a row, all titles, etc.
     '''
     qdc = QualifiedDublinCoreElement()
     qdc.term = 'SUB'
     qdc.content = 'TEST'
     dcterms = QualifiedDublinCoreElement.objects.all()
     seen = defaultdict(int)
     curterm = dcterms[0].term
     for qdct in dcterms:
         if curterm != qdct.term:
             #switched or revisited
             if seen[qdct.term] == 1:
                 self.fail('Out of order term:%s' % qdct)
         curterm = qdct.term
         seen[qdct.term] = 1
Ejemplo n.º 6
0
    def testTermsGrouped(self):
        ''' Test that the DC for an object is grouped by the term type
        ie all subject terms come in a row, all titles, etc.
        '''
#        arkobject = ARKObject.objects.get(pk=1)
        qdc = QualifiedDublinCoreElement()
        qdc.term = 'SUB'
        qdc.content = 'TEST'
#        arkobject.QDCElements.add(qdc)
#        dcterms = arkobject.QDCElements.all()
        dcterms = QualifiedDublinCoreElement.objects.all()
        seen = defaultdict(int)
        curterm = dcterms[0].term
        for qdct in dcterms:
            if curterm != qdct.term:
                #switched or revisited
                if seen[qdct.term] == 1:
                    #print arkobject.QDCElements.all()
                    self.fail('Out of order term:%s' % qdct)
            curterm = qdct.term
            seen[qdct.term] = 1