The basic answer is that if you test anything, it would not be a qualitative study, but a mixed methods study. Testings as it is understood in quantitative analyses does not exist in qualitative studies. Potential mediators and moderators could be examined using qualitative methods. I hope this is helpful!
I agree that "testing" effects is not part of qualitative research. However, you could assess mediating and moderating effects is more qualitative fashion. In particular, all moderation means is that some process operates differently in one setting or group than it does in another. So, if you are comparing two cases, then any major difference would amount to moderation.
It would be useful if you defined what you mean by "qualitative." The previous commentators I believe are assume it is used as in some of the social sciences, and I guess they are defining it as not "testing" something. In stats people often talk about qualitative versus quantitative data (i.e., categorical v metric), and in the sciences quantitative v qualitative hypotheses (i.e., x > y versus x = y). Even if you mean the distinction as used in sociology (and related disciplines), it would be worth providing what definition you mean.
Of course, you could "define" qualitative as "not amenable to definition". That's not as daft as it seems - maybe if one added "a priori" in there it would be clearer. Relational and process approaches, for example, would emphasise the importance of shifting contexts and relativities between elements to giving a plasticity to qualitative concepts; other thinkers drawing perhaps on Lacan, Lyotard or Wittgenstein would emphasise the inadequacy or incompleteness of language (or any symbolic representation) to capture or define reality. Hence for them qualitative research needs to remain open to this "remainder", definitions (operational and temporalised) being where you end up (if you're lucky) rather than where you start.
Qualitative research has its own philosophy and diverges from quant/mathematical concepts. However, if you mean, can you do a qualitative study about patient experiences with mediators or moderators - using great caution in how you word your questions, and not pre-supposing answers, it may be possible. It would not be wise to pre-make categories etc- For example, if a mediator for women with breast cancer is social support- the question and its effect is on quality of life- you might ask a question like- Tell me about your lived experiences of social support and the ways it has affected (if any) how you see your quality of life after breast cancer. This is just a quick take on this-