def test_build_master_key_provider_additional_kwargs( patch_load_master_key_provider): kwargs = {"a": 1, "b": "asdf", "discovery": True} master_key_parsing._build_master_key_provider( provider=sentinel.unknown_provider_id, key=[], **kwargs) patch_load_master_key_provider.return_value.assert_called_once_with( **kwargs)
def test_build_master_key_provider_add_keys(patch_load_master_key_provider): mock_provider = MagicMock() patch_load_master_key_provider.return_value.return_value = mock_provider master_key_parsing._build_master_key_provider( discovery=True, provider=sentinel.unknown_provider_id, key=[sentinel.key_id_1, sentinel.key_id_2] ) mock_provider.add_master_key.assert_has_calls( calls=(call(sentinel.key_id_1), call(sentinel.key_id_2)), any_order=False )
def test_build_master_key_provider_known_provider(patch_load_master_key_provider): mock_provider_callable = MagicMock() patch_load_master_key_provider.return_value = mock_provider_callable test = master_key_parsing._build_master_key_provider( discovery=sentinel.discovery, provider=sentinel.known_provider_id, key=[], a=sentinel.a, b=sentinel.b ) patch_load_master_key_provider.assert_called_once_with(sentinel.known_provider_id) mock_provider_callable.assert_called_once_with(a=sentinel.a, b=sentinel.b, discovery=sentinel.discovery) assert not mock_provider_callable.return_value.add_master_key.called assert test is mock_provider_callable.return_value