Skip to content

Commit

Permalink
PowerBi().refresh() - use last completed refresh time regardless of a…
Browse files Browse the repository at this point in the history
… pending refresh
  • Loading branch information
Radek Buczkowski committed Mar 4, 2024
1 parent 6027bc8 commit 4d08184
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/spetlr/power_bi/PowerBi.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ def _get_last_refresh(self) -> bool:
self.last_status = None
self.last_exception = None
self.last_refresh_utc = None
self.last_duration_in_seconds = 0

# Note: we fetch only the latest refresh record, i.e. top=1
api_url = (
Expand Down
4 changes: 4 additions & 0 deletions tests/local/power_bi/test_power_bi.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def test_get_last_refresh_failure(self, mock_get):

sut = PowerBi(PowerBiClient(), workspace_id="test", dataset_id="test")
sut.powerbi_url = "test"
sut.last_status = "test"
sut.last_duration_in_seconds = 5
sut._connect = lambda: True

# Act
Expand All @@ -150,6 +152,8 @@ def test_get_last_refresh_failure(self, mock_get):
"The specified dataset or workspace cannot be found",
str(context.exception),
)
self.assertIsNone(sut.last_status) # must be cleared!
self.assertEqual(sut.last_duration_in_seconds, 5) # must be kept unchanged!

def test_verify_last_refresh_success(self):
# Arrange
Expand Down

0 comments on commit 4d08184

Please sign in to comment.