Skip to content

Commit

Permalink
Normalize line endings
Browse files Browse the repository at this point in the history
  • Loading branch information
3noch committed Sep 27, 2012
1 parent 9946988 commit 5315730
Show file tree
Hide file tree
Showing 14 changed files with 772 additions and 833 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
38 changes: 19 additions & 19 deletions LICENSE.txt
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.
64 changes: 32 additions & 32 deletions README.txt
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
74 changes: 37 additions & 37 deletions test/test_connecting.py
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
Loading

0 comments on commit 5315730

Please sign in to comment.