def test_updated_components_none_updated(mocker, cachet_client, cachet_response): """Assert no components are considered updated if there are no actual changes""" mock_get = mocker.patch('cachetclient.cachet.Components.get') mock_get.return_value = cachet_response status = load_from_json('updated_components_none_updated.json') updated_components = list(cachet_client.updated_components(status)) assert len(updated_components) == 0
def test_updated_components_two_updated(mocker, cachet_client, cachet_response): """Assert the right components are considered updated""" mock_get = mocker.patch('cachetclient.cachet.Components.get') mock_get.return_value = cachet_response status = load_from_json('updated_components_two_updated.json') updated_components = list(cachet_client.updated_components(status)) assert len(updated_components) == 2 assert any(comp['id'] == 3 for comp in updated_components) assert any(comp['id'] == 6 for comp in updated_components)
def saved_status_multi_updates(): return load_from_json('saved_status_multi_updates.json')
def matching_cases(): return load_from_json('matching_components_cases.json')
def matching_list(): return load_from_json('matching_components_list.json')
def cachet_response(): return json.dumps(load_from_json('cachet_response.json'))