def TestRenameexport_MissingNewName(self): with self.assertRaises(SystemExit): self.annex.Listen(io.StringIO("EXPORT Name\nRENAMEEXPORT Key")) self.assertEqual( utils.last_buffer_line(self.output), "ERROR Expected TRANSFER STORE Key File", )
def TestRemoveexportdirectory_MissingDirectory(self): with self.assertRaises(SystemExit): self.annex.Listen(io.StringIO("REMOVEEXPORTDIRECTORY")) self.assertEqual( utils.last_buffer_line(self.output), "ERROR do_REMOVEEXPORTDIRECTORY() missing 1 required positional argument: 'name'", )
def TestRenameexport_WithoutExport(self): with self.assertRaises(SystemExit): self.annex.Listen(io.StringIO("RENAMEEXPORT Key NewName")) self.assertEqual( utils.last_buffer_line(self.output), "ERROR Export request without prior EXPORT", )
def TestTransferexportRetrieve_WithoutExport(self): with self.assertRaises(SystemExit): self.annex.Listen(io.StringIO("TRANSFEREXPORT RETRIEVE Key")) self.assertEqual( utils.last_buffer_line(self.output), "ERROR Export request without prior EXPORT", )
def TestCheckpresentexport_WithoutExport(self): with self.assertRaises(SystemExit): self.annex.Listen(io.StringIO("CHECKPRESENTEXPORT Key")) self.assertEqual( utils.last_buffer_line(self.output), "ERROR Export request without prior EXPORT", )
def TestExport_MissingName(self): with self.assertRaises(SystemExit): self.annex.Listen(io.StringIO("EXPORT")) self.assertEqual( utils.last_buffer_line(self.output), "ERROR do_EXPORT() missing 1 required positional argument: 'name'", )
def TestGetavailabilityInvalid(self): self.remote.getavailability.return_value = "something else" with self.assertRaises(SystemExit): self.annex.Listen(io.StringIO("GETAVAILABILITY")) self.assertEqual( utils.last_buffer_line(self.output), "ERROR Availability must be either 'global' or 'local'")
def TestListconfigsSpaceInName(self): self.remote.listconfigs.return_value = { 'Name with space': 'Description' } with self.assertRaises(SystemExit): self.annex.Listen(io.StringIO("LISTCONFIGS")) self.assertEqual( utils.last_buffer_line(self.output), "ERROR Name must not contain space characters: Name with space")
def TestCheckurlMultiSpaceInFilename(self): urllist = [{ 'url': "Url1", 'size': 512, 'filename': "Filename with spaces" }, { 'url': "Url2", 'filename': "Filename2" }] self.remote.checkurl.return_value = urllist with self.assertRaises(SystemExit): self.annex.Listen(io.StringIO("CHECKURL Url")) self.assertEqual(utils.last_buffer_line(self.output), "ERROR Filename must not contain spaces.")
def TestCheckurlMultiSpaceInUrl(self): urllist = [ { "url": "Url with spaces", "size": 512, "filename": "Filename1" }, { "url": "Url2", "filename": "Filename2" }, ] self.remote.checkurl.return_value = urllist with self.assertRaises(SystemExit): self.annex.Listen(io.StringIO("CHECKURL Url")) self.assertEqual(utils.last_buffer_line(self.output), "ERROR Url must not contain spaces.")
def TestTransferRetrieve_MissingFilename(self): with self.assertRaises(SystemExit): self.annex.Listen(io.StringIO("TRANSFER RETRIEVE Key")) self.assertEqual(utils.last_buffer_line(self.output), "ERROR Expected Key File")
def TestTransferexportStore_MissingFilename(self): with self.assertRaises(SystemExit): self.annex.Listen( io.StringIO("EXPORT Name\nTRANSFEREXPORT STORE Key")) self.assertEqual(utils.last_buffer_line(self.output), "ERROR Expected Key File")
def TestGetcostInvalid(self): self.remote.getcost.return_value = "not a number" with self.assertRaises(SystemExit): self.annex.Listen(io.StringIO("GETCOST")) self.assertEqual(utils.last_buffer_line(self.output), "ERROR Cost must be an integer")