Ejemplo n.º 1
0
 def test_expand_db_attributes_not_for_editor(self):
     result = DocumentLinkHandler.expand_db_attributes(
         {'id': 1},
         False
     )
     self.assertEqual(result,
                      '<a href="/documents/1/test.pdf">')
Ejemplo n.º 2
0
 def test_expand_db_attributes_for_editor(self):
     result = DocumentLinkHandler.expand_db_attributes(
         {'id': 1},
         True
     )
     self.assertEqual(result,
                      '<a data-linktype="document" data-id="1" href="/documents/1/test.pdf">')
Ejemplo n.º 3
0
 def test_expand_db_attributes_with_missing_id(self):
     result = FrontendDocumentLinkHandler.expand_db_attributes({})
     self.assertEqual(result, '<a>')
Ejemplo n.º 4
0
 def test_expand_db_attributes_document_does_not_exist(self):
     result = FrontendDocumentLinkHandler.expand_db_attributes({'id': 0})
     self.assertEqual(result, '<a>')
Ejemplo n.º 5
0
 def test_expand_db_attributes_for_frontend(self):
     result = FrontendDocumentLinkHandler.expand_db_attributes({'id': 1})
     self.assertEqual(result, '<a href="/documents/1/test.pdf">')
Ejemplo n.º 6
0
 def test_expand_db_attributes_for_editor_with_missing_id(self):
     result = DocumentLinkHandler.expand_db_attributes({})
     self.assertEqual(result, '<a data-linktype="document">')
Ejemplo n.º 7
0
 def test_expand_db_attributes_for_editor_preserves_id_of_nonexistent_document(
         self):
     result = DocumentLinkHandler.expand_db_attributes({'id': 0})
     self.assertEqual(result, '<a data-linktype="document" data-id="0">')
Ejemplo n.º 8
0
 def test_expand_db_attributes_with_missing_id(self):
     result = FrontendDocumentLinkHandler.expand_db_attributes({})
     self.assertEqual(result, '<a>')
Ejemplo n.º 9
0
 def test_expand_db_attributes_document_does_not_exist(self):
     result = FrontendDocumentLinkHandler.expand_db_attributes({'id': 0})
     self.assertEqual(result, '<a>')
Ejemplo n.º 10
0
 def test_expand_db_attributes_for_frontend(self):
     result = FrontendDocumentLinkHandler.expand_db_attributes({'id': 1})
     self.assertEqual(
         result,
         '<a href="/documents/1/test.pdf">'
     )