Ejemplo n.º 1
0
 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",
     )
Ejemplo n.º 2
0
 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'",
     )
Ejemplo n.º 3
0
 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",
     )
Ejemplo n.º 4
0
 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",
     )
Ejemplo n.º 5
0
 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",
     )
Ejemplo n.º 6
0
 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.")
Ejemplo n.º 10
0
 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.")
Ejemplo n.º 11
0
 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")
Ejemplo n.º 12
0
 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")
Ejemplo n.º 13
0
 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")