def test_get_unit_by_id__valid_unit__defaults(get_data): get_data.return_value = {'1234': {}} result = user_settings.get_unit_by_id(1234) assert result.should_ring_bell == 1 assert isinstance(result.recipients, dict) assert len(result.recipients) == 0
def test_get_unit_by_id__valid_unit__int_id(get_data): get_data.return_value = {'1234': {}} result = user_settings.get_unit_by_id(1234) assert isinstance(result, user_settings.Unit) def test_get_unit_by_id__valid_unit__string_id(get_data): get_data.return_value = {'1234': {}} result = user_settings.get_unit_by_id('1234') assert isinstance(result, user_settings.Unit)
def test_get_unit_by_id__valid_unit__recipients(get_data): get_data.return_value = { '1234': { 'recipients': { '+14155551001': 1, 'asdf1234=': 2, } } } result = user_settings.get_unit_by_id(1234) assert result.recipients == { '+14155551001': 1, 'asdf1234=': 2, }
def test_get_unit_by_id__valid_unit__empty_recipients(get_data): get_data.return_value = {'1234': {'recipients': None}} result = user_settings.get_unit_by_id(1234) assert isinstance(result.recipients, dict)
def test_get_unit_by_id__valid_unit__not_should_ring_bell(get_data): get_data.return_value = {'1234': {'chime': 0}} result = user_settings.get_unit_by_id(1234) assert not result.should_ring_bell
def test_get_unit_by_id__missing_unit(get_data): get_data.return_value = {'5678': {}} result = user_settings.get_unit_by_id(1234) assert result is None