-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
772 additions
and
833 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
Copyright (c) 2012 Covenant Eyes Inc. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
Copyright (c) 2012 Covenant Eyes Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
win_unc | ||
======= | ||
**WORK IN PROGRESS** - |TravisBadge|_ | ||
Python library for handling UNC mounting on Windows. | ||
.. |TravisBadge| image:: https://secure.travis-ci.org/CovenantEyes/py_win_unc.png?branch=master | ||
.. _TravisBadge: http://travis-ci.org/CovenantEyes/py_win_unc | ||
Unit Testing | ||
------------ | ||
To run the unit tests, do the following:: | ||
$ python test/run_tests.py | ||
For all the tests to run, you must perform them on a Windows machine:: | ||
> python test\run_tests.py | ||
License | ||
======= | ||
This package is released under the | ||
`MIT License`_. (See LICENSE.txt.) | ||
.. _MIT License: http://www.opensource.org/licenses/mit-license.php | ||
win_unc | ||
======= | ||
|
||
**WORK IN PROGRESS** - |TravisBadge|_ | ||
|
||
|
||
Python library for handling UNC mounting on Windows. | ||
|
||
|
||
.. |TravisBadge| image:: https://secure.travis-ci.org/CovenantEyes/py_win_unc.png?branch=master | ||
.. _TravisBadge: http://travis-ci.org/CovenantEyes/py_win_unc | ||
|
||
|
||
Unit Testing | ||
------------ | ||
|
||
To run the unit tests, do the following:: | ||
|
||
$ python test/run_tests.py | ||
|
||
For all the tests to run, you must perform them on a Windows machine:: | ||
|
||
> python test\run_tests.py | ||
|
||
|
||
License | ||
======= | ||
|
||
This package is released under the | ||
`MIT License`_. (See LICENSE.txt.) | ||
|
||
.. _MIT License: http://www.opensource.org/licenses/mit-license.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,37 @@ | ||
from unittest import TestCase | ||
|
||
from win_unc.connecting import get_current_net_use_table, UncDirectoryConnection | ||
from win_unc.unc_directory import UncDirectory | ||
from win_unc.internal.shell import run | ||
|
||
|
||
LOCALHOST_UNC = r'\\localhost\IPC$' | ||
|
||
|
||
class TestUncDirectoryConnection(TestCase): | ||
def setUp(self): | ||
self.localhost_was_connected = self.localhost_connected() | ||
if self.localhost_was_connected: | ||
run('NET USE ' + LOCALHOST_UNC + ' /DELETE') | ||
|
||
def tearDown(self): | ||
if self.localhost_was_connected: | ||
run('NET USE ' + LOCALHOST_UNC) | ||
|
||
def test_connect(self): | ||
unc = UncDirectory(r'\\localhost') | ||
conn = UncDirectoryConnection(unc) | ||
conn.connect() | ||
|
||
self.assertTrue(self.localhost_connected()) | ||
self.assertTrue(conn.is_connected()) | ||
|
||
conn.disconnect() | ||
|
||
self.assertFalse(self.localhost_connected()) | ||
self.assertFalse(conn.is_connected()) | ||
|
||
def localhost_connected(self): | ||
net_use = get_current_net_use_table() | ||
paths = [path.lower() for path in net_use.get_connected_paths()] | ||
return LOCALHOST_UNC.lower() in paths | ||
from unittest import TestCase | ||
|
||
from win_unc.connecting import get_current_net_use_table, UncDirectoryConnection | ||
from win_unc.unc_directory import UncDirectory | ||
from win_unc.internal.shell import run | ||
|
||
|
||
LOCALHOST_UNC = r'\\localhost\IPC$' | ||
|
||
|
||
class TestUncDirectoryConnection(TestCase): | ||
def setUp(self): | ||
self.localhost_was_connected = self.localhost_connected() | ||
if self.localhost_was_connected: | ||
run('NET USE ' + LOCALHOST_UNC + ' /DELETE') | ||
|
||
def tearDown(self): | ||
if self.localhost_was_connected: | ||
run('NET USE ' + LOCALHOST_UNC) | ||
|
||
def test_connect(self): | ||
unc = UncDirectory(r'\\localhost') | ||
conn = UncDirectoryConnection(unc) | ||
conn.connect() | ||
|
||
self.assertTrue(self.localhost_connected()) | ||
self.assertTrue(conn.is_connected()) | ||
|
||
conn.disconnect() | ||
|
||
self.assertFalse(self.localhost_connected()) | ||
self.assertFalse(conn.is_connected()) | ||
|
||
def localhost_connected(self): | ||
net_use = get_current_net_use_table() | ||
paths = [path.lower() for path in net_use.get_connected_paths()] | ||
return LOCALHOST_UNC.lower() in paths |
Oops, something went wrong.