Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
Merge branch 'patch-1' of git://github.com/Stvad/wifi into Stvad-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
rockymeza committed Feb 11, 2016
2 parents fdb4372 + c3e7cdb commit 14b12e6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
22 changes: 22 additions & 0 deletions tests/test_init.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from unittest import TestCase

from wifi.scan import Cell

class CorrectInitTest(TestCase):
fields = {"ssid": None,
"bitrates": [],
"address": None,
"channel": None,
"encrypted": False,
"encryption_type": None,
"frequency": None,
"mode": None,
"quality": None,
"signal": None}


def test_empty_init(self):
tcell = Cell()

for field, value in self.fields.iteritems():
self.assertEqual(value, getattr(tcell, field))
10 changes: 9 additions & 1 deletion wifi/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ class Cell(object):
def __init__(self):
self.ssid = None
self.bitrates = []
self.address = None
self.channel = None
self.encrypted = False
self.encryption_type = None
self.frequency = None
self.mode = None
self.quality = None
self.signal = None

def __repr__(self):
return 'Cell(ssid={ssid})'.format(**vars(self))
Expand Down Expand Up @@ -151,7 +159,7 @@ def normalize(cell_block):

# It seems that encryption types other than WEP need to specify their
# existence.
if cell.encrypted and not hasattr(cell, 'encryption_type'):
if cell.encrypted and not cell.encryption_type:
cell.encryption_type = 'wep'

return cell

0 comments on commit 14b12e6

Please sign in to comment.