示例#1
0
def test_Registry_init ():
  key = registry.Registry (TEST_KEY, access=win32con.KEY_ALL_ACCESS)
  assert key.moniker == TEST_KEY
  assert key.name == "winsys"
  assert key.access == win32con.KEY_ALL_ACCESS
  print key.id
  assert key.id == registry._parse_moniker (TEST_KEY.lower ())
示例#2
0
 def test_Registry_from_string(self):
     key = registry.Registry.from_string(TEST_KEY)
     self.assertEqual(key.moniker, TEST_KEY)
     self.assertEqual(
         key.access,
         registry.Registry._access(registry.Registry.DEFAULT_ACCESS))
     self.assertEqual(key.id, registry._parse_moniker(TEST_KEY.lower()))
示例#3
0
 def test_moniker_computer_root_and_body (self):
   self.assertEquals (registry._parse_moniker (r"\\COMPUTER\HKLM\Software\Microsoft"), ("COMPUTER", win32con.HKEY_LOCAL_MACHINE, r"Software\Microsoft", None))
示例#4
0
 def test_moniker_root_only (self):
   self.assertEquals (registry._parse_moniker ("HKLM"), (None, win32con.HKEY_LOCAL_MACHINE, "", None))
示例#5
0
 def test_moniker_invalid_root (self):
   with self.assertRaises (registry.x_moniker_no_root):
     registry._parse_moniker (r"<nonsense>")
示例#6
0
 def test_moniker_root_and_body(self):
     self.assertEqual(
         registry._parse_moniker(r"HKLM\Software\Microsoft"),
         (None, win32con.HKEY_LOCAL_MACHINE, r"Software\Microsoft", None))
示例#7
0
 def test_Registry_init(self):
     key = registry.Registry(TEST_KEY, access=win32con.KEY_ALL_ACCESS)
     self.assertEqual(key.moniker, TEST_KEY)
     self.assertEqual(key.name, "winsys")
     self.assertEqual(key.access, win32con.KEY_ALL_ACCESS)
     self.assertEqual(key.id, registry._parse_moniker(TEST_KEY.lower()))
示例#8
0
def test_moniker_invalid_root ():
  registry._parse_moniker (r"<nonsense>")
示例#9
0
 def test_Registry_from_string (self):
   key = registry.Registry.from_string (TEST_KEY)
   assert key.moniker == TEST_KEY
   assert key.access == registry.Registry._access (registry.Registry.DEFAULT_ACCESS)
   assert key.id == registry._parse_moniker (TEST_KEY.lower ())
示例#10
0
def test_moniker_default_value ():
  assert_equals (registry._parse_moniker (r"HKLM\Software\Microsoft:"), (None, win32con.HKEY_LOCAL_MACHINE, r"Software\Microsoft", ""))
示例#11
0
def test_moniker_create ():
  parts = "COMPUTER", win32con.HKEY_LOCAL_MACHINE, "PATH", "VALUE"
  assert_equals (registry._parse_moniker (registry.create_moniker (*parts)), parts)
示例#12
0
def test_moniker_body_only ():
  registry._parse_moniker (r"Software\Microsoft")
示例#13
0
def test_moniker_root_only ():
  assert_equals (registry._parse_moniker ("HKLM"), (None, win32con.HKEY_LOCAL_MACHINE, "", None))
示例#14
0
def test_moniker_slash_and_root ():
  assert_equals (registry._parse_moniker (r"\HKLM"), (None, win32con.HKEY_LOCAL_MACHINE, "", None))
示例#15
0
 def test_moniker_value (self):
   self.assertEquals (registry._parse_moniker (r"HKLM\Software\Microsoft:value"), (None, win32con.HKEY_LOCAL_MACHINE, r"Software\Microsoft", "value"))
示例#16
0
 def test_moniker_computer_only(self):
     with self.assertRaises(registry.x_moniker_no_root):
         registry._parse_moniker(r"\\computer")
示例#17
0
 def test_moniker_create (self):
   parts = "COMPUTER", win32con.HKEY_LOCAL_MACHINE, "PATH", None
   self.assertEquals (registry._parse_moniker (registry.create_moniker (*parts)), parts)
示例#18
0
 def test_moniker_invalid_root(self):
     with self.assertRaises(registry.x_moniker_no_root):
         registry._parse_moniker(r"<nonsense>")
示例#19
0
 def test_moniker_create(self):
     parts = "COMPUTER", win32con.HKEY_LOCAL_MACHINE, "PATH", None
     self.assertEqual(registry._parse_moniker(registry.create_moniker(*parts)), parts)
示例#20
0
 def test_moniker_slash_and_root(self):
     self.assertEqual(registry._parse_moniker(r"\HKLM"),(None, win32con.HKEY_LOCAL_MACHINE, "", None))
示例#21
0
 def test_Registry_from_string(self):
     key = registry.Registry.from_string(TEST_KEY)
     self.assertEqual(key.moniker, TEST_KEY)
     self.assertEqual(key.access, registry.Registry._access(registry.Registry.DEFAULT_ACCESS))
     self.assertEqual(key.id, registry._parse_moniker(TEST_KEY.lower()))
示例#22
0
 def test_moniker_root_only(self):
     self.assertEqual(registry._parse_moniker("HKLM"),(None, win32con.HKEY_LOCAL_MACHINE, "", None))
示例#23
0
 def test_Registry_init(self):
     key = registry.Registry(TEST_KEY, access=win32con.KEY_ALL_ACCESS)
     self.assertEqual(key.moniker, TEST_KEY)
     self.assertEqual(key.name, "winsys")
     self.assertEqual(key.access, win32con.KEY_ALL_ACCESS)
     self.assertEqual(key.id, registry._parse_moniker(TEST_KEY.lower()))
示例#24
0
 def test_moniker_computer_and_root(self):
     self.assertEqual(registry._parse_moniker(r"\\COMPUTER\HKLM"),("COMPUTER", win32con.HKEY_LOCAL_MACHINE, "", None))
示例#25
0
 def test_moniker_computer_only (self):
   with self.assertRaises (registry.x_moniker_no_root):
     registry._parse_moniker (r"\\computer")
示例#26
0
 def test_moniker_root_and_body(self):
     self.assertEqual(registry._parse_moniker(r"HKLM\Software\Microsoft"),(None, win32con.HKEY_LOCAL_MACHINE, r"Software\Microsoft", None))
示例#27
0
 def test_moniker_slash_and_root (self):
   self.assertEquals (registry._parse_moniker (r"\HKLM"), (None, win32con.HKEY_LOCAL_MACHINE, "", None))
示例#28
0
 def test_moniker_computer_root_and_body(self):
     self.assertEqual(registry._parse_moniker(r"\\COMPUTER\HKLM\Software\Microsoft"),("COMPUTER", win32con.HKEY_LOCAL_MACHINE, r"Software\Microsoft", None))
示例#29
0
 def test_moniker_computer_and_root (self):
   self.assertEquals (registry._parse_moniker (r"\\COMPUTER\HKLM"), ("COMPUTER", win32con.HKEY_LOCAL_MACHINE, "", None))
示例#30
0
 def test_moniker_body_only(self):
     with self.assertRaises(registry.x_moniker_no_root):
         registry._parse_moniker(r"Software\Microsoft")
示例#31
0
 def test_moniker_body_only (self):
   with self.assertRaises (registry.x_moniker_no_root):
     registry._parse_moniker (r"Software\Microsoft")
示例#32
0
 def test_moniker_value(self):
     self.assertEqual(registry._parse_moniker(r"HKLM\Software\Microsoft:value"),(None, win32con.HKEY_LOCAL_MACHINE, r"Software\Microsoft", "value"))
示例#33
0
 def test_moniker_create_named_root (self):
   parts = "COMPUTER", "HKLM", "PATH", "VALUE"
   result = "COMPUTER", win32con.HKEY_LOCAL_MACHINE, "PATH", "VALUE"
   self.assertEquals (registry._parse_moniker (registry.create_moniker (*parts)), result)
示例#34
0
 def test_moniker_create_named_root(self):
     parts = "COMPUTER", "HKLM", "PATH", "VALUE"
     result = "COMPUTER", win32con.HKEY_LOCAL_MACHINE, "PATH", "VALUE"
     self.assertEqual(registry._parse_moniker(registry.create_moniker(*parts)), result)
示例#35
0
 def test_Registry_from_string (self):
   key = registry.Registry.from_string (TEST_KEY)
   assert key.moniker == TEST_KEY
   assert key.access == registry.Registry._access (registry.Registry.DEFAULT_ACCESS)
   assert key.id == registry._parse_moniker (TEST_KEY.lower ())
示例#36
0
def test_moniker_computer_only ():
  registry._parse_moniker (r"\\computer")