예제 #1
0
def test_notifyapp_called(infopl, alfred4):
    """Notify.app is called"""
    c = WorkflowMock()
    notify.install_notifier()
    with c:
        assert notify.notify('Test Title', 'Test Message') is False
        assert c.cmd[0] == APPLET_PATH
예제 #2
0
def test_notifyapp_called(infopl, alfred4):
    """Notify.app is called"""
    c = WorkflowMock()
    notify.install_notifier()
    with c:
        assert notify.notify('Test Title', 'Test Message') is False
        assert c.cmd[0] == APPLET_PATH
예제 #3
0
 def test_notifyapp_called(self):
     """Notify.app is called"""
     c = WorkflowMock()
     with InfoPlist():
         notify.install_notifier()
         with c:
             self.assertFalse(notify.notify('Test Title', 'Test Message'))
             self.assertEqual(c.cmd[0], APPLET_PATH)
예제 #4
0
def test_install(infopl, alfred4, applet):
    """Notify.app is installed correctly"""
    assert os.path.exists(APP_PATH) is False, "APP_PATH exists"
    notify.install_notifier()
    for p in (APP_PATH, APPLET_PATH, ICON_PATH, INFO_PATH):
        assert os.path.exists(p) is True, "path not found"
    # Ensure applet is executable
    assert os.stat(APPLET_PATH).st_mode & stat.S_IXUSR, "applet not executable"
    # Verify bundle ID was changed
    data = plistlib.readPlist(INFO_PATH)
    bid = data.get("CFBundleIdentifier")
    assert bid != BUNDLE_ID, "bundle IDs identical"
    assert bid.startswith(BUNDLE_ID) is True, "bundle ID not prefix"
예제 #5
0
def test_image_conversion(infopl, alfred4, tempdir, applet):
    """PNG to ICNS conversion"""
    assert os.path.exists(APP_PATH) is False
    notify.install_notifier()
    assert os.path.exists(APP_PATH) is True
    icns_path = os.path.join(tempdir, 'icon.icns')
    assert os.path.exists(icns_path) is False
    notify.png_to_icns(PNG_PATH, icns_path)
    assert os.path.exists(icns_path) is True
    with open(icns_path, 'rb') as fp:
        h1 = hashlib.md5(fp.read())
    with open(ICON_PATH, 'rb') as fp:
        h2 = hashlib.md5(fp.read())
    assert h1.digest() == h2.digest()
예제 #6
0
def test_install(infopl, alfred4, applet):
    """Notify.app is installed correctly"""
    assert os.path.exists(APP_PATH) is False, "APP_PATH exists"
    notify.install_notifier()
    for p in (APP_PATH, APPLET_PATH, ICON_PATH, INFO_PATH):
        assert os.path.exists(p) is True, "path not found"
    # Ensure applet is executable
    assert (os.stat(APPLET_PATH).st_mode & stat.S_IXUSR), \
        "applet not executable"
    # Verify bundle ID was changed
    data = plistlib.readPlist(INFO_PATH)
    bid = data.get('CFBundleIdentifier')
    assert bid != BUNDLE_ID, "bundle IDs identical"
    assert bid.startswith(BUNDLE_ID) is True, "bundle ID not prefix"
예제 #7
0
def test_image_conversion(infopl, alfred4, tempdir, applet):
    """PNG to ICNS conversion"""
    assert os.path.exists(APP_PATH) is False
    notify.install_notifier()
    assert os.path.exists(APP_PATH) is True
    icns_path = os.path.join(tempdir, 'icon.icns')
    assert os.path.exists(icns_path) is False
    notify.png_to_icns(PNG_PATH, icns_path)
    assert os.path.exists(icns_path) is True
    with open(icns_path, 'rb') as fp:
        h1 = hashlib.md5(fp.read())
    with open(ICON_PATH, 'rb') as fp:
        h2 = hashlib.md5(fp.read())
    assert h1.digest() == h2.digest()
예제 #8
0
 def test_install(self):
     """Notify.app is installed correctly"""
     with InfoPlist():
         self.assertFalse(os.path.exists(APP_PATH))
         notify.install_notifier()
         for p in (APP_PATH, APPLET_PATH, ICON_PATH, INFO_PATH):
             self.assertTrue(os.path.exists(p))
         # Ensure applet is executable
         self.assert_(os.stat(APPLET_PATH).st_mode & stat.S_IXUSR)
         # Verify bundle ID was changed
         data = plistlib.readPlist(INFO_PATH)
         bid = data.get('CFBundleIdentifier')
         self.assertNotEqual(bid, BUNDLE_ID)
         self.assertTrue(bid.startswith(BUNDLE_ID))
예제 #9
0
 def test_image_conversion(self):
     """PNG to ICNS conversion"""
     with InfoPlist():
         self.assertFalse(os.path.exists(APP_PATH))
         notify.install_notifier()
         self.assertTrue(os.path.exists(APP_PATH))
         icns_path = os.path.join(self.tempdir, 'icon.icns')
         self.assertFalse(os.path.exists(icns_path))
         notify.png_to_icns(PNG_PATH, icns_path)
         self.assertTrue(os.path.exists(icns_path))
         with open(icns_path, 'rb') as fp:
             h1 = hashlib.md5(fp.read())
         with open(ICON_PATH, 'rb') as fp:
             h2 = hashlib.md5(fp.read())
         self.assertEqual(h1.digest(), h2.digest())