コード例 #1
0
ファイル: tests.py プロジェクト: davecranwell/wagtail
 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">')
コード例 #2
0
ファイル: tests.py プロジェクト: davecranwell/wagtail
 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">')
コード例 #3
0
ファイル: tests.py プロジェクト: rrluthi/wagtail
 def test_expand_db_attributes_not_for_editor(self):
     result = DocumentLinkHandler.expand_db_attributes(
         {'id': 1},
         False
     )
     self.assertEqual(result,
                      '<a href="/documents/1/">')
コード例 #4
0
ファイル: tests.py プロジェクト: rrluthi/wagtail
 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/">')
コード例 #5
0
ファイル: tests.py プロジェクト: sixpearls/wagtail
 def test_get_db_attributes(self):
     soup = BeautifulSoup(
         '<a data-id="test-id">foo</a>'
     )
     tag = soup.a
     result = DocumentLinkHandler.get_db_attributes(tag)
     self.assertEqual(result,
                      {'id': 'test-id'})
コード例 #6
0
ファイル: tests.py プロジェクト: rrluthi/wagtail
 def test_get_db_attributes(self):
     soup = BeautifulSoup(
         '<a data-id="test-id">foo</a>'
     )
     tag = soup.a
     result = DocumentLinkHandler.get_db_attributes(tag)
     self.assertEqual(result,
                      {'id': 'test-id'})
コード例 #7
0
ファイル: tests.py プロジェクト: davecranwell/wagtail
 def test_expand_db_attributes_document_does_not_exist(self):
     result = DocumentLinkHandler.expand_db_attributes(
         {'id': 0},
         False
     )
     self.assertEqual(result, '<a>')
コード例 #8
0
ファイル: tests.py プロジェクト: wizardlie/wagtail
 def test_expand_db_attributes_document_does_not_exist(self):
     result = DocumentLinkHandler.expand_db_attributes({'id': 0}, False)
     self.assertEqual(result, '<a>')
コード例 #9
0
ファイル: tests.py プロジェクト: m1kola/wagtail
 def test_get_db_attributes(self):
     soup = BeautifulSoup('<a data-id="test-id">foo</a>', "html5lib")
     tag = soup.a
     result = DocumentLinkHandler.get_db_attributes(tag)
     self.assertEqual(result, {"id": "test-id"})