diff options
author | Zachary Ware <zachary.ware@gmail.com> | 2013-11-26 14:57:10 -0600 |
---|---|---|
committer | Zachary Ware <zachary.ware@gmail.com> | 2013-11-26 14:57:10 -0600 |
commit | 99fb0513ddf8b0315ed717d08ced1fa28d144f05 (patch) | |
tree | 682abc19c49b58468f5168b70ddb120601eff164 /Lib/test | |
parent | a6edea530bb9f3a9ff6234f443ea5d00428a7635 (diff) | |
parent | 56507c7862b6e2de189b6a942f394efb676cdb0b (diff) | |
download | cpython-git-99fb0513ddf8b0315ed717d08ced1fa28d144f05.tar.gz |
Merge heads
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_uuid.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/test_uuid.py b/Lib/test/test_uuid.py index 97ad6d0c2f..0a47a91a73 100644 --- a/Lib/test/test_uuid.py +++ b/Lib/test/test_uuid.py @@ -1,5 +1,7 @@ import unittest +from test import support import builtins +import io import os import uuid @@ -356,6 +358,25 @@ class TestUUID(unittest.TestCase): self.assertEqual(node1, node2) + def test_find_mac(self): + data = '''\ + +fake hwaddr +cscotun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 +eth0 Link encap:Ethernet HWaddr 12:34:56:78:90:ab +''' + def mock_popen(cmd): + return io.StringIO(data) + + with support.swap_attr(os, 'popen', mock_popen): + mac = uuid._find_mac( + command='ifconfig', + args='', + hw_identifiers=['hwaddr'], + get_index=lambda x: x + 1, + ) + self.assertEqual(mac, 0x1234567890ab) + @unittest.skipUnless(importable('ctypes'), 'requires ctypes') def test_uuid1(self): equal = self.assertEqual |