[Pyunit-interest] More testing aid requested
Brought to you by:
purcell
From: Jesse W <je...@lo...> - 2001-12-02 23:45:47
|
Dear kind py-unit members, I posted a question about a week ago regarding my attempts to create a website updating program by test-first-design. I got a lot of useful answers. I have now written two tests, and written a class which makes the tests succeed, but the class does not actually send any files anywhere. How do I make a test that requires the module to actually _send_ the files instead of simply faking it as my class now does? (code enclosed below) Thank you all for your time and answers, Jesse Weinstein --main.py---- lass Connection: def __init__(self): self.files_sent=[] def connect(self): pass def send_file(self, file): self.files_sent.append(file) def listfiles(self): return self.files_sent ---tests.py---- import main TEST_FILE='c:/python22/mywork/updater/testfile' class ConnectionTestCase(unittest.TestCase): def setUp(self): self.c=main.Connection() self.c.connect() def testConectionCanBeMade(self): pass #just use setUp actions def testFileSent(self): self.c.send_file(TEST_FILE) assert TEST_FILE in self.c.listfiles(), 'TEST_FILE not found in listfiles return value!' <more unittest administration code (if __name__=='__main__', etc.) snipped> |