• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

iplweb / bpp / f77eb09d-4388-431e-b9f3-4fc7a8822640

28 Aug 2025 08:13PM UTC coverage: 39.949% (-3.5%) from 43.402%
f77eb09d-4388-431e-b9f3-4fc7a8822640

push

circleci

mpasternak
Whatever

16244 of 40662 relevant lines covered (39.95%)

0.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
src/bpp/tests/test_export/test_bibtex_export_in_admin.py
1
"""Simple test for BibTeX export functionality in admin."""
2

3
from django.test import TestCase
×
4
from model_bakery import baker
×
5

6
from bpp.admin.xlsx_export.formats import PrettyXLSX
×
7
from bpp.admin.xlsx_export.resources import (
×
8
    BibTeXFormat,
9
    PatentBibTeXResource,
10
    Praca_DoktorskaBibTeXResource,
11
    Praca_HabilitacyjnaBibTeXResource,
12
    Wydawnictwo_CiagleBibTeXResource,
13
)
14
from bpp.models import Patent, Praca_Doktorska, Praca_Habilitacyjna, Wydawnictwo_Ciagle
×
15

16

17
class TestBibTeXExportInAdmin(TestCase):
×
18
    """Test BibTeX export functionality."""
19

20
    def test_bibtex_resource_export(self):
×
21
        """Test that BibTeX resource can export publications."""
22
        # Create a simple publication
23
        wydawnictwo = baker.make(
×
24
            Wydawnictwo_Ciagle,
25
            tytul_oryginalny="Test Article",
26
            rok=2023,
27
        )
28

29
        # Create resource and test export
30
        resource = Wydawnictwo_CiagleBibTeXResource()
×
31
        queryset = Wydawnictwo_Ciagle.objects.filter(pk=wydawnictwo.pk)
×
32

33
        result = resource.export(queryset)
×
34

35
        # Check that we get a result
36
        self.assertIsNotNone(result)
×
37
        result_str = str(result)
×
38
        self.assertIn("Test Article", result_str)
×
39

40
    def test_bibtex_format_properties(self):
×
41
        """Test BibTeX format properties."""
42
        bibtex_format = BibTeXFormat()
×
43

44
        self.assertEqual(bibtex_format.get_title(), "BibTeX")
×
45
        self.assertEqual(bibtex_format.get_extension(), "bib")
×
46
        self.assertTrue(bibtex_format.can_export())
×
47
        self.assertFalse(bibtex_format.can_import())
×
48

49
    def test_format_titles(self):
×
50
        """Test that format titles are user-friendly."""
51
        bibtex_format = BibTeXFormat()
×
52
        xlsx_format = PrettyXLSX()
×
53

54
        self.assertEqual(bibtex_format.get_title(), "BibTeX")
×
55
        self.assertEqual(xlsx_format.get_title(), "prettyxlsx")
×
56

57
    def test_patent_bibtex_resource_export(self):
×
58
        """Test that Patent BibTeX resource can export patents."""
59
        # Create a simple patent
60
        patent = baker.make(
×
61
            Patent,
62
            tytul_oryginalny="Test Patent",
63
            rok=2023,
64
        )
65

66
        # Create resource and test export
67
        resource = PatentBibTeXResource()
×
68
        queryset = Patent.objects.filter(pk=patent.pk)
×
69

70
        result = resource.export(queryset)
×
71

72
        # Check that we get a result
73
        self.assertIsNotNone(result)
×
74
        result_str = str(result)
×
75
        self.assertIn("Test Patent", result_str)
×
76

77
    def test_praca_doktorska_bibtex_resource_export(self):
×
78
        """Test that Praca_Doktorska BibTeX resource can export dissertations."""
79
        # Create a simple doctoral dissertation
80
        praca_doktorska = baker.make(
×
81
            Praca_Doktorska,
82
            tytul_oryginalny="Test Doctoral Dissertation",
83
            rok=2023,
84
        )
85

86
        # Create resource and test export
87
        resource = Praca_DoktorskaBibTeXResource()
×
88
        queryset = Praca_Doktorska.objects.filter(pk=praca_doktorska.pk)
×
89

90
        result = resource.export(queryset)
×
91

92
        # Check that we get a result
93
        self.assertIsNotNone(result)
×
94
        result_str = str(result)
×
95
        self.assertIn("Test Doctoral Dissertation", result_str)
×
96

97
    def test_praca_habilitacyjna_bibtex_resource_export(self):
×
98
        """Test that Praca_Habilitacyjna BibTeX resource can export habilitation theses."""
99
        # Create a simple habilitation thesis
100
        praca_habilitacyjna = baker.make(
×
101
            Praca_Habilitacyjna,
102
            tytul_oryginalny="Test Habilitation Thesis",
103
            rok=2023,
104
        )
105

106
        # Create resource and test export
107
        resource = Praca_HabilitacyjnaBibTeXResource()
×
108
        queryset = Praca_Habilitacyjna.objects.filter(pk=praca_habilitacyjna.pk)
×
109

110
        result = resource.export(queryset)
×
111

112
        # Check that we get a result
113
        self.assertIsNotNone(result)
×
114
        result_str = str(result)
×
115
        self.assertIn("Test Habilitation Thesis", result_str)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc