Back to index

python3.2  3.2.2
Public Member Functions | Private Member Functions
test.test_netrc.NetrcTestCase Class Reference

List of all members.

Public Member Functions

def tearDown
def make_nrc
def test_default
def test_macros
def test_password_with_leading_hash
def test_password_with_trailing_hash
def test_password_with_internal_hash
def test_comment_before_machine_line
def test_comment_before_machine_line_no_space
def test_comment_before_machine_line_hash_only
def test_comment_at_end_of_machine_line
def test_comment_at_end_of_machine_line_no_space
def test_comment_at_end_of_machine_line_pass_has_hash

Private Member Functions

def _test_passwords
def _test_comment

Detailed Description

Definition at line 6 of file test_netrc.py.


Member Function Documentation

def test.test_netrc.NetrcTestCase._test_comment (   self,
  nrc,
  passwd = 'pass' 
) [private]

Definition at line 61 of file test_netrc.py.

00061 
00062     def _test_comment(self, nrc, passwd='pass'):
00063         nrc = self.make_nrc(nrc)
00064         self.assertEqual(nrc.hosts['foo.domain.com'], ('bar', None, passwd))
00065         self.assertEqual(nrc.hosts['bar.domain.com'], ('foo', None, 'pass'))

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_netrc.NetrcTestCase._test_passwords (   self,
  nrc,
  passwd 
) [private]

Definition at line 42 of file test_netrc.py.

00042 
00043     def _test_passwords(self, nrc, passwd):
00044         nrc = self.make_nrc(nrc)
00045         self.assertEqual(nrc.hosts['host.domain.com'], ('log', 'acct', passwd))

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_netrc.NetrcTestCase.make_nrc (   self,
  test_data 
)

Definition at line 11 of file test_netrc.py.

00011 
00012     def make_nrc(self, test_data):
00013         test_data = textwrap.dedent(test_data)
00014         mode = 'w'
00015         if sys.platform != 'cygwin':
00016             mode += 't'
00017         with open(temp_filename, mode) as fp:
00018             fp.write(test_data)
00019         return netrc.netrc(temp_filename)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 8 of file test_netrc.py.

00008 
00009     def tearDown(self):
00010         os.unlink(temp_filename)

Here is the caller graph for this function:

Definition at line 87 of file test_netrc.py.

00087 
00088     def test_comment_at_end_of_machine_line(self):
00089         self._test_comment("""\
00090             machine foo.domain.com login bar password pass # comment
00091             machine bar.domain.com login foo password pass
00092             """)

Here is the call graph for this function:

Definition at line 93 of file test_netrc.py.

00093 
00094     def test_comment_at_end_of_machine_line_no_space(self):
00095         self._test_comment("""\
00096             machine foo.domain.com login bar password pass #comment
00097             machine bar.domain.com login foo password pass
00098             """)

Here is the call graph for this function:

Definition at line 99 of file test_netrc.py.

00099 
00100     def test_comment_at_end_of_machine_line_pass_has_hash(self):
00101         self._test_comment("""\
00102             machine foo.domain.com login bar password #pass #comment
00103             machine bar.domain.com login foo password pass
00104             """, '#pass')
00105 

Here is the call graph for this function:

Definition at line 66 of file test_netrc.py.

00066 
00067     def test_comment_before_machine_line(self):
00068         self._test_comment("""\
00069             # comment
00070             machine foo.domain.com login bar password pass
00071             machine bar.domain.com login foo password pass
00072             """)

Here is the call graph for this function:

Definition at line 80 of file test_netrc.py.

00080 
00081     def test_comment_before_machine_line_hash_only(self):
00082         self._test_comment("""\
00083             #
00084             machine foo.domain.com login bar password pass
00085             machine bar.domain.com login foo password pass
00086             """)

Here is the call graph for this function:

Definition at line 73 of file test_netrc.py.

00073 
00074     def test_comment_before_machine_line_no_space(self):
00075         self._test_comment("""\
00076             #comment
00077             machine foo.domain.com login bar password pass
00078             machine bar.domain.com login foo password pass
00079             """)

Here is the call graph for this function:

Definition at line 20 of file test_netrc.py.

00020 
00021     def test_default(self):
00022         nrc = self.make_nrc("""\
00023             machine host1.domain.com login log1 password pass1 account acct1
00024             default login log2 password pass2
00025             """)
00026         self.assertEqual(nrc.hosts['host1.domain.com'],
00027                          ('log1', 'acct1', 'pass1'))
00028         self.assertEqual(nrc.hosts['default'], ('log2', None, 'pass2'))

Here is the call graph for this function:

Definition at line 29 of file test_netrc.py.

00029 
00030     def test_macros(self):
00031         nrc = self.make_nrc("""\
00032             macdef macro1
00033             line1
00034             line2
00035 
00036             macdef macro2
00037             line3
00038             line4
00039             """)
00040         self.assertEqual(nrc.macros, {'macro1': ['line1\n', 'line2\n'],
00041                                       'macro2': ['line3\n', 'line4\n']})

Here is the call graph for this function:

Definition at line 56 of file test_netrc.py.

00056 
00057     def test_password_with_internal_hash(self):
00058         self._test_passwords("""\
00059             machine host.domain.com login log password pa#ss account acct
00060             """, 'pa#ss')

Here is the call graph for this function:

Definition at line 46 of file test_netrc.py.

00046 
00047     def test_password_with_leading_hash(self):
00048         self._test_passwords("""\
00049             machine host.domain.com login log password #pass account acct
00050             """, '#pass')

Here is the call graph for this function:

Definition at line 51 of file test_netrc.py.

00051 
00052     def test_password_with_trailing_hash(self):
00053         self._test_passwords("""\
00054             machine host.domain.com login log password pass# account acct
00055             """, 'pass#')

Here is the call graph for this function:


The documentation for this class was generated from the following file: