They should be taking the property owner to court because he is responsible, not the renter. It sounds like you may be going to court because they want you to testify to the present condition of the property. Unless there are parts to the story you are leaving out or are unaware of, the owner is responsible for the home.
Be honest at court, from what you've said there is no reason for you to lie about anything. They can only evict you if they think it is unsafe. and if they do evict you they may be responsible for finding you a place to live. They can't put you on the street legally if you're paying the rent.
I hope you have pictures and proof of what you say. Otherwise you just sound like any deadbeat tenant. Sorry, I know that isn't what you want to hear. The city inspectors should have come out and told the landlord what he must do and by when. It's too late if court is tomorrow. Just put what you have in order so that you present your case concisely and quickly without leaving out any facts. Make notes if you must. You should have written to your landlord and mailed it return receipt and you would have proof of asking your landlord to fix things or get the inspection. All you can do is your best. Good luck.
Take note of every time you call. Time and date. Even if you called and didn't get any one. Then note when they don't call you back. Every piece of info is important. I even call with the computer so I can record their calls. Business to business recording is illegal without notice but person to business is just fine in my state. You would have to check your state law on that one. But I'm fighting the city also. Every piece of info you get, you will need. They count as government also and you need proof if you want to win.
As a general rule, it is illegal for any landlord to charge rent or allow anyone to live in a unit that is unfit for human habitation. If they misrepresented the premises as "livable", the contract may be void, as a matter of law. Your local attorneys will have a field day with this, if you're willing to pay their fees up front.
I assume you've moved out? Let them take you to court. Live and learn.
I'm 19 yrs old I have a 6 month old, when i finally saved up enough to start looking for my own place to rent I found a property management called aspect properties in Rochester, Michigan. They showed me a few different places mind you, the first few they showed me had stickers on the windows about the grass needing to be cut so when I chose the last house they showed I assumed the signs on the windows were the same for the grass. So I signed a 13 month lease for the home, a couple days after I moved in I was outside read the sign and it was from the city of warren saying that the house was not to be occupied until it passed an inspection at that point I contacted aspect properties numerous times about doing an inspection they never really said anything about it. Meanwhile, all the sinks in my home began to leak my bathtub would not train water, the cheap rails on both of my porches outside fell apart. I began to notice the walls and floor behind my stove falling apart and mold. After many calls I finally got some body over from aspect properties but every time they came they would just look i would have to wait another week and than they would fix it. after they refused to set up a city inspection I called the city myself, they informed me that these guys knew better and suggested I get a lawyer. We set up an inspection nothing was approved. I refused to pay, now they're taking me to court for an eviction. Courts in the AM. I'd just like to know what to expect??