• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In
Build has been canceled!

SEED-platform / seed / #9248

19 Mar 2026 08:06PM UTC coverage: 24.649% (-61.6%) from 86.216%
#9248

push

coveralls-python

web-flow
Merge be617fd54 into 4090d9eaa

161 of 333 new or added lines in 46 files covered. (48.35%)

30936 existing lines in 308 files now uncovered.

12306 of 49925 relevant lines covered (24.65%)

0.25 hits per line

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

24.07
/seed/lib/progress_data/tests/test_progress_data.py
1
"""
2
SEED Platform (TM), Copyright (c) Alliance for Energy Innovation, LLC, and other contributors.
3
See also https://github.com/SEED-platform/seed/blob/main/LICENSE.md
4
"""
5

6
import logging
1✔
7

8
import pytest
1✔
9
from django.test import TestCase
10

11
from seed.lib.progress_data.progress_data import ProgressData
1✔
12

13
logger = logging.getLogger(__name__)
1✔
14

15

16
class TestProgressData(TestCase):
1✔
17
    """Tests that our logic for constructing cleaners works."""
18

19
    def setUp(self):
1✔
UNCOV
20
        pass
×
21

22
    def test_create_progress(self):
1✔
UNCOV
23
        pd = ProgressData(func_name="test_func", unique_id="abc123")
×
24

UNCOV
25
        self.assertEqual(pd.key, ":1:SEED:test_func:PROG:abc123")
×
26

UNCOV
27
        data_eql = {
×
28
            "status": "not-started",
29
            "status_message": "",
30
            "summary": None,
31
            "stacktrace": None,
32
            "func_name": "test_func",
33
            "progress_key": ":1:SEED:test_func:PROG:abc123",
34
            "progress": 0,
35
            "message": None,
36
            "total": None,
37
            "unique_id": "abc123",
38
        }
UNCOV
39
        self.assertEqual(pd.data["status"], "not-started")
×
UNCOV
40
        self.assertDictEqual(pd.data, data_eql)
×
UNCOV
41
        self.assertEqual(pd.total, None)
×
42

43
    def test_total_progress(self):
1✔
UNCOV
44
        pd = ProgressData(func_name="test_func_2", unique_id="def456")
×
UNCOV
45
        pd.total = 10
×
UNCOV
46
        self.assertEqual(pd.increment_value(), 10)
×
47

48
    def test_init_by_data(self):
1✔
UNCOV
49
        pd = ProgressData(func_name="test_func_3", unique_id="ghi789")
×
UNCOV
50
        pd.total = 100
×
UNCOV
51
        self.assertEqual(pd.key, ":1:SEED:test_func_3:PROG:ghi789")
×
52

UNCOV
53
        pd2 = ProgressData.from_key(pd.key)
×
UNCOV
54
        self.assertDictEqual(pd.data, pd2.data)
×
55

56
    def test_key_missing(self):
1✔
UNCOV
57
        with pytest.raises(Exception) as exc:  # noqa: PT011
×
UNCOV
58
            ProgressData.from_key("some_random_key")
×
UNCOV
59
        self.assertEqual(str(exc.value), "Could not find key some_random_key in cache")
×
60

61
    def test_delete_cache(self):
1✔
UNCOV
62
        pd = ProgressData(func_name="test_func_4", unique_id="1q2w3e")
×
UNCOV
63
        pd.total = 525600
×
UNCOV
64
        pd.data["status"] = "doing-something"
×
UNCOV
65
        pd.save()
×
66

UNCOV
67
        self.assertEqual(pd.result()["total"], 525600)
×
UNCOV
68
        self.assertEqual(pd.data["status"], "doing-something")
×
UNCOV
69
        self.assertEqual(pd.delete()["total"], None)
×
70

71
    def test_status_message(self):
1✔
UNCOV
72
        pd = ProgressData(func_name="test_func_5", unique_id="plokij")
×
UNCOV
73
        pd.total = 42
×
UNCOV
74
        pd.step("Stepping")
×
75

UNCOV
76
        self.assertEqual(pd.result()["total"], 42)
×
UNCOV
77
        self.assertEqual(pd.result()["status_message"], "Stepping")
×
78

79
        # if we call step again, then the status message should not change
UNCOV
80
        pd.step()
×
UNCOV
81
        self.assertEqual(pd.result()["status_message"], "Stepping")
×
82

83
        # Now passing in empty string will reset
UNCOV
84
        pd.step("")
×
UNCOV
85
        self.assertEqual(pd.result()["status_message"], "")
×
86

87
    def test_summary(self):
1✔
UNCOV
88
        pd = ProgressData(func_name="test_func_6", unique_id="pokemon")
×
UNCOV
89
        self.assertIsNone(pd.summary())
×
90

UNCOV
91
        new_summary = {"Values": ["As", "A", "List"]}
×
UNCOV
92
        pd.update_summary(new_summary)
×
UNCOV
93
        self.assertEqual(pd.summary(), new_summary)
×
94

UNCOV
95
        pd.step(new_summary=4815162342)
×
UNCOV
96
        self.assertEqual(pd.summary(), 4815162342)
×
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