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" )
def test_check_format_devicefile_2(self): schema = openmediavault.datamodel.Schema({}) schema._check_format( "/dev/disk/by-id/wwn-0x5020c298d81c1c3a", {"format": "devicefile"}, "field1", )
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" )
def test_check_one_of(self): schema = openmediavault.json.Schema({}) schema._check_format("192.168.10.101", { "type": "string", "oneOf": [{ "type": "string", "format": "ipv6" },{ "type": "string", "format": "ipv4" }] }, "field3")
def test_check_format_hostname_fail(self): schema = openmediavault.json.Schema({}) self.assertRaises( openmediavault.json.SchemaValidationException, lambda: schema._check_format("myvault.local", {"format": "host-name"}, "field3"), )
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"), )
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"), )
def test_check_format_sharename(self): schema = openmediavault.datamodel.Schema({}) schema._check_format("data", {"format": "sharename"}, "field1")
def test_check_format_domainname(self): schema = openmediavault.datamodel.Schema({}) schema._check_format("test.com", {"format": "domainname"}, "field1")
def test_check_format_hostname_fail(self): schema = openmediavault.json.Schema({}) self.assertRaises(openmediavault.json.SchemaValidationException, lambda: schema._check_format("myvault.local", { "format": "host-name" }, "field3"))
def test_check_format_email(self): schema = openmediavault.json.Schema({}) schema._check_format("*****@*****.**", {"format": "email"}, "field2")
def test_check_format_fsuuid_2(self): # FAT schema = openmediavault.datamodel.Schema({}) schema._check_format("7A48-BA97", { "format": "fsuuid" }, "field1")
def test_check_format_unknown_fail(self): schema = openmediavault.json.Schema({}) self.assertRaises( openmediavault.json.SchemaException, lambda: schema._check_format("abc", {"format": "abc"}, "abc"))
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")
def test_check_format_dirpath_1(self): schema = openmediavault.datamodel.Schema({}) schema._check_format("/media/a/b/c/@data", {"format": "dirpath"}, "field1")
def test_check_format_devicefile_2(self): schema = openmediavault.datamodel.Schema({}) schema._check_format("/dev/disk/by-id/wwn-0x5020c298d81c1c3a", { "format": "devicefile" }, "field1")
def test_check_format_fsuuid_2(self): # FAT schema = openmediavault.datamodel.Schema({}) schema._check_format("7A48-BA97", {"format": "fsuuid"}, "field1")
def test_check_format_devicefile_1(self): schema = openmediavault.datamodel.Schema({}) schema._check_format("/dev/sda1", { "format": "devicefile" }, "field1")
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")
def test_check_format_fsuuid_3(self): # NTFS schema = openmediavault.datamodel.Schema({}) schema._check_format("2ED43920D438EC29", { "format": "fsuuid" }, "field1")
def test_check_format_sharename_fail(self): schema = openmediavault.datamodel.Schema({}) self.assertRaises( openmediavault.json.SchemaValidationException, lambda: schema._check_format(".foo", {"format": "sharename"}, "field1") )
def test_check_format_sharename(self): schema = openmediavault.datamodel.Schema({}) schema._check_format("data", {"format": "sharename"}, "field1")
def test_check_format_dirpath_1(self): schema = openmediavault.datamodel.Schema({}) schema._check_format("/media/a/b/c/@data", { "format": "dirpath" }, "field1")
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") )
def test_check_format_fsuuid_3(self): # NTFS schema = openmediavault.datamodel.Schema({}) schema._check_format("2ED43920D438EC29", {"format": "fsuuid"}, "field1")
def test_check_format_dirpath_2(self): schema = openmediavault.datamodel.Schema({}) schema._check_format("Library/App Support/Logs/", { "format": "dirpath" }, "field1")
def test_check_format_devicefile_1(self): schema = openmediavault.datamodel.Schema({}) schema._check_format("/dev/sda1", {"format": "devicefile"}, "field1")
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"))
def test_check_format_dirpath_2(self): schema = openmediavault.datamodel.Schema({}) schema._check_format("Library/App Support/Logs/", {"format": "dirpath"}, "field1")
def test_check_format_unknown(self): schema = openmediavault.json.Schema({}) self.assertRaises(openmediavault.json.SchemaException, lambda: schema._check_format("abc", { "format": "abc" }, "abc"))
def test_check_format_domainname(self): schema = openmediavault.datamodel.Schema({}) schema._check_format("test.com", {"format": "domainname"}, "field1")
def test_check_format_regex(self): schema = openmediavault.json.Schema({}) schema._check_format('/^\d{4}-\d{2}-\d{2}$/', { "format": "regex" }, "field1")
def test_check_format_regex(self): schema = openmediavault.json.Schema({}) schema._check_format('^\d{4}-\d{2}-\d{2}$', {"format": "regex"}, "field1")
def test_check_format_email(self): schema = openmediavault.json.Schema({}) schema._check_format("*****@*****.**", { "format": "email" }, "field2")
def test_check_format_hostname(self): schema = openmediavault.json.Schema({}) schema._check_format("myvault", {"format": "host-name"}, "field3")
def test_check_format_hostname(self): schema = openmediavault.json.Schema({}) schema._check_format("myvault", { "format": "host-name" }, "field3")