def test_WebFrontend_WithBasicHTTPAuthentication(self): self.writeFile("var/log/dmesg", "something") client = logbeamwrapper.FTP(self.playground, self.server) client.upload("var/log/dmesg") self.frontend.cleanup() self.frontend = logbeamwrapper.WebFrontend(self.server, secure=True) self.assertEquals(self.frontend.fetch("dmesg"), "something") self.assertIn(">dmesg<", self.frontend.fetch(""))
def test_WebFrontend_FetchNonCompressedFile(self): self.writeFile("var/log/dmesg", "something") client = logbeamwrapper.FTP(self.playground, self.server) client.upload("var/log/dmesg") self.assertEquals(self.server.fileCount(), 1) self.assertFileAtServer("dmesg", "something") self.assertEquals(self.frontend.fetch("dmesg"), "something") self.assertIn(">dmesg<", self.frontend.fetch(""))
def test_UploadAFile_WithUnder(self): self.writeFile("var/log/dmesg", "something") client = logbeamwrapper.FTP(self.playground, self.server, compressed=True, baseDir="project/hash/build") client.upload("var/log/dmesg", under="var_log") self.assertEquals(self.server.fileCount(), 5) self.assertFileCompressedAtServer("project/hash/build/var_log/dmesg", "something")
def test_UploadACompressedDirectory_With100Files(self): for i in xrange(100): self.writeFile("var/log/file%d" % i, "something") client = logbeamwrapper.FTP(self.playground, self.server, compressed=True) client.upload("var/log") self.assertEquals(self.server.fileCount(), 100) for i in xrange(100): self.assertFileCompressedAtServer("file%d" % i, "something")
def test_UploadADirectory(self): self.writeFile("var/log/dmesg", "something") self.writeFile("var/log/myself.log", "something else") client = logbeamwrapper.FTP(self.playground, self.server, compressed=False) client.upload("var/log", under="var_log") self.assertEquals(self.server.fileCount(), 3) self.assertFileAtServer("var_log/dmesg", "something") self.assertFileAtServer("var_log/myself.log", "something else")