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

blues / note-python / 13265549868

11 Feb 2025 02:45PM UTC coverage: 91.663% (-0.1%) from 91.797%
13265549868

Pull #94

github

web-flow
Merge ee5696b13 into 63e3dcaa2
Pull Request #94: feat: add card.transport method for NTN connectivity

10 of 11 new or added lines in 1 file covered. (90.91%)

5 existing lines in 2 files now uncovered.

2078 of 2267 relevant lines covered (91.66%)

4.54 hits per line

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

89.47
/test/fluent_api/conftest.py
1
import sys
5✔
2
import os
5✔
3
import pytest
5✔
4
from unittest.mock import MagicMock
5✔
5

6
sys.path.insert(0,
5✔
7
                os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')))
8

9
import notecard  # noqa: E402
5✔
10

11

12
class MockNotecard(notecard.Notecard):
5✔
13
    def Reset(self):
5✔
UNCOV
14
        pass
×
15

16
    def lock(self):
5✔
UNCOV
17
        pass
×
18

19
    def unlock(self):
5✔
UNCOV
20
        pass
×
21

22
    def _transact(self, req_bytes, rsp_expected, timeout_secs):
5✔
UNCOV
23
        pass
×
24

25

26
@pytest.fixture
5✔
27
def run_fluent_api_notecard_api_mapping_test():
3✔
28
    def _run_test(fluent_api, notecard_api_name, req_params, rename_map=None):
5✔
29
        card = MockNotecard()
5✔
30
        card.Transaction = MagicMock()
5✔
31

32
        # Convert string 'true'/'false' to Python bool for allow parameter
33
        api_params = {}
5✔
34
        for key, value in req_params.items():
5✔
35
            if key == 'allow':
5✔
36
                api_params[key] = value == 'true'
5✔
37
            else:
38
                api_params[key] = value
5✔
39

40
        fluent_api(card, **api_params)
5✔
41
        expected_notecard_api_req = {'req': notecard_api_name, **req_params}
5✔
42

43
        # Handle parameter mapping
44
        if rename_map is not None:
5✔
45
            for old_key, new_key in rename_map.items():
5✔
46
                expected_notecard_api_req[new_key] = expected_notecard_api_req.pop(old_key)
5✔
47

48
        card.Transaction.assert_called_once_with(expected_notecard_api_req)
5✔
49

50
    return _run_test
5✔
51

52

53
@pytest.fixture
5✔
54
def run_fluent_api_invalid_notecard_test():
3✔
55
    def _run_test(fluent_api, req_params):
5✔
56
        with pytest.raises(Exception, match='Notecard object required'):
5✔
57
            # Call with None instead of a valid Notecard object.
58
            fluent_api(None, **req_params)
5✔
59

60
    return _run_test
5✔
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