Exemple #1
0
 def test_check_format_devicefile_2(self):
     schema = openmediavault.datamodel.Schema({})
     schema._check_format(
         "/dev/disk/by-id/wwn-0x5020c298d81c1c3a",
         {"format": "devicefile"},
         "field1",
     )
Exemple #2
0
 def test_check_format_fsuuid_1(self):
     # EXT2/3/4, JFS, XFS
     schema = openmediavault.datamodel.Schema({})
     schema._check_format(
         "113dbaac-e496-11e6-ac68-73bc0f572bae",
         {"format": "fsuuid"},
         "field1",
     )
Exemple #3
0
 def test_check_format_sshprivkey_rsa(self):
     schema = openmediavault.datamodel.Schema({})
     schema._check_format(
         "-----BEGIN RSA PRIVATE KEY-----\n"
         "MIIEogIBAAKCAQEAka7AN9KaHJnZ4huPlWhbaYJFIQ7AXKEZ5mpUWoa4yudmldSs\n"
         "xLB4BNdDK0Qj5QmgGVYJsywqriabe+OfSciUUpFO5+AIFTHoSQM=\n"
         "-----END RSA PRIVATE KEY-----", {"format": "sshprivkey-rsa"},
         "foo")
Exemple #4
0
 def test_check_format_sshpubkey_rfc4716(self):
     schema = openmediavault.datamodel.Schema({})
     schema._check_format(
         "---- BEGIN SSH2 PUBLIC KEY ----\n"
         "AAAAB3NzaC1yc2EAAAABJQAAAQBZ9s5nqsH6bwB1ljF3DHBRs05PpeWIZEYnYRF5\n"
         "qU9YwfGHe6ZRXTpV/5XvSXvkIr3moKyXiCAzSD20yffEAXT7\n"
         "---- END SSH2 PUBLIC KEY ----", {"format": "sshpubkey-rfc4716"},
         "bar")
Exemple #5
0
 def test_check_format_domainname_fail(self):
     schema = openmediavault.datamodel.Schema({})
     self.assertRaises(
         openmediavault.json.SchemaValidationException,
         lambda: schema._check_format("te:t#com", {"format": "domainname"},
                                      "field1"),
     )
Exemple #6
0
 def test_check_format_dirpath_fail(self):
     schema = openmediavault.datamodel.Schema({})
     self.assertRaises(
         openmediavault.json.SchemaValidationException,
         lambda: schema._check_format("/media/a/../../b/c",
                                      {"format": "dirpath"}, "field1"),
     )
Exemple #7
0
 def test_check_format_sshpubkey_rfc4716_fail(self):
     schema = openmediavault.datamodel.Schema({})
     self.assertRaises(
         openmediavault.json.SchemaValidationException,
         lambda: schema._check_format(
             "---- BEGIN SSH2 PUBLIC KEY ----\n"
             "AAAAB3NzaC1yc2EAAAABJQAAAQBZ9s5nqsH6bwB1ljF3DHBRs05PpeWIZEYnYRF5\n"
             "qU9YwfGHe6ZRXTpV/5XvSXvkIr3moKyXiCAzSD20yffEAXT7\n",
             {"format": "sshpubkey-rfc4716"}, "bar"))
Exemple #8
0
 def test_check_format_domainname(self):
     schema = openmediavault.datamodel.Schema({})
     schema._check_format("test.com", {"format": "domainname"}, "field1")
Exemple #9
0
 def test_check_format_sharename(self):
     schema = openmediavault.datamodel.Schema({})
     schema._check_format("data", {"format": "sharename"}, "field1")
Exemple #10
0
 def test_check_format_dirpath_2(self):
     schema = openmediavault.datamodel.Schema({})
     schema._check_format("Library/App Support/Logs/",
                          {"format": "dirpath"}, "field1")
Exemple #11
0
 def test_check_format_dirpath_1(self):
     schema = openmediavault.datamodel.Schema({})
     schema._check_format("/media/a/b/c/@data", {"format": "dirpath"},
                          "field1")
Exemple #12
0
 def test_check_format_devicefile_1(self):
     schema = openmediavault.datamodel.Schema({})
     schema._check_format("/dev/sda1", {"format": "devicefile"}, "field1")
Exemple #13
0
 def test_check_format_fsuuid_3(self):
     # ISO9660
     schema = openmediavault.datamodel.Schema({})
     schema._check_format("2015-01-13-21-48-46-00", {"format": "fsuuid"},
                          "field1")
Exemple #14
0
 def test_check_format_fsuuid_3(self):
     # NTFS
     schema = openmediavault.datamodel.Schema({})
     schema._check_format("2ED43920D438EC29", {"format": "fsuuid"},
                          "field1")
Exemple #15
0
 def test_check_format_fsuuid_2(self):
     # FAT
     schema = openmediavault.datamodel.Schema({})
     schema._check_format("7A48-BA97", {"format": "fsuuid"}, "field1")
Exemple #16
0
 def test_check_format_sshpubkey_openssh(self):
     schema = openmediavault.datamodel.Schema({})
     schema._check_format("ssh-rsa AAAAB3NzaC1yc2ADkcdByshQm577 bar@baz",
                          {"format": "sshpubkey-openssh"}, "foo")