This repository has been archived by the owner on Aug 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Chk fra #13
Open
ghost
wants to merge
2
commits into
master
Choose a base branch
from
chk-fra
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Chk fra #13
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,3 +1,9 @@ | ||
Flask | ||
git+https://github.com/martel-innovate/wifi.git@rpi-fix | ||
python-wifi | ||
|
||
#In case of error, comment this line | ||
wifi | ||
|
||
#In case of error, uncomment this line | ||
#git+https://github.com/martel-innovate/wifi.git@rpi-fix | ||
|
||
python-wifi |
Empty file.
Empty file.
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,21 @@ | ||
# Run test eWine-Connectivity-Manager | ||
|
||
## RUNNING | ||
* open 2 shell tabs | ||
In the 1st shell : | ||
$ /home/pi/eWine-connectivity-manager/wifi_manager/interpreter/python_venv.sh | ||
|
||
* In the 2nd shell: | ||
$ cd /home/pi/eWine-connectivity-manager/ | ||
$ . .venv/bin/activate | ||
|
||
$ sudo ifup wlan0 #to activate the wireless card, if it is down | ||
$ wifi list #once time command to check if your wifi connection is stored | ||
$ wifi add yournamewifi SSID #USE this command ONLY if your wifi connection is not in the list --- more information ../wifi/docs/wifi_command.rst | ||
$ cd tests | ||
$ sudo python test_core.py #launch test | ||
|
||
if the test fails, try to launch these commands: | ||
sudo ifup wlan0 | ||
sudo wifi connect SSID #even if your wireless card is already connected | ||
sudo python test_core.py #launch test |
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,4 +1,6 @@ | ||
from context import os, core | ||
import time | ||
import pdb | ||
import unittest | ||
import sqlite3 | ||
import tempfile | ||
|
@@ -24,48 +26,60 @@ def setUp(self): | |
self.gps_inf = -1000.0 | ||
|
||
def tearDown(self): | ||
time.sleep(20) | ||
os.close(self.db_fd) | ||
os.unlink(self.db_name) | ||
|
||
def test_0a_disable(self): | ||
time.sleep(20) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When you have to do the same at the beginning of all your tests... who do you call? |
||
code = core.disable(self.iface) | ||
self.assertEqual(code, 0) | ||
|
||
def test_0b_interfaces(self): | ||
time.sleep(20) | ||
ifaces = core.interfaces() | ||
self.assertIsInstance(ifaces, list) | ||
self.assertNotIn(self.iface, ifaces) | ||
|
||
def test_0c_status(self): | ||
time.sleep(20) | ||
status = core.status(self.iface) | ||
self.assertEqual(status, '') | ||
|
||
def test_0d_scan(self): | ||
time.sleep(20) | ||
self.assertRaises(core.WifiException, core.cell_all, self.iface) | ||
|
||
def test_0e_available(self): | ||
time.sleep(20) | ||
self.assertRaises(core.WifiException, core.available, self.iface) | ||
|
||
def test_0f_save(self): | ||
time.sleep(20) | ||
self.assertRaises(core.WifiException, core.save, self.iface, 'foo', 'foo', self.db) | ||
|
||
def test_0g_connect(self): | ||
time.sleep(20) | ||
self.assertRaises(core.WifiException, core.connect, self.iface, 'foo', 'foo', self.db) | ||
|
||
def test_1a_enable(self): | ||
time.sleep(20) | ||
code = core.enable(self.iface) | ||
self.assertEqual(code, 0) | ||
|
||
def test_1b_interfaces(self): | ||
time.sleep(20) | ||
ifaces = core.interfaces() | ||
self.assertIsInstance(ifaces, list) | ||
self.assertNotIn(self.iface, ifaces) | ||
self.assertIn(self.iface, ifaces) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have an explanation for this maybe? a comment or something would help. Same for the change in test below. |
||
|
||
def test_1c_status(self): | ||
time.sleep(20) | ||
status = core.status(self.iface) | ||
self.assertEqual(status, '') | ||
|
||
self.assertNotEqual(status, '') | ||
def test_1d_scan(self): | ||
time.sleep(20) | ||
cells = core.cell_all(self.iface) | ||
self.assertIsInstance(cells, list) | ||
|
||
|
@@ -84,31 +98,37 @@ def test_1d_scan(self): | |
self.assertIsInstance(c["encryption_type"], str) | ||
|
||
def available_test(self): | ||
time.sleep(20) | ||
# the network configuration must be stored before running the test | ||
avail = core.available(self.iface) | ||
self.assertIsInstance(avail, str) | ||
self.assertTrue(len(avail) > 0) | ||
return avail | ||
|
||
def test_1e_save(self): | ||
time.sleep(20) | ||
self.assertRaises(core.WifiException, core.save, self.iface, 'foo', 'foo', self.db) | ||
|
||
def test_2a_connect(self): | ||
time.sleep(20) | ||
avail = self.available_test() | ||
core.connect(self.iface, avail, None, self.db) | ||
|
||
def test_2b_interfaces(self): | ||
time.sleep(20) | ||
ifaces = core.interfaces() | ||
self.assertIsInstance(ifaces, list) | ||
self.assertIn(self.iface, ifaces) | ||
|
||
def test_2c_status(self): | ||
time.sleep(20) | ||
status = core.status(self.iface) | ||
avail = self.available_test() | ||
self.assertIsInstance(status, str) | ||
self.assertEqual(status, avail) | ||
|
||
def test_2d_location(self): | ||
time.sleep(20) | ||
avail = self.available_test() | ||
lat, lng = core.get_last_location(avail, self.db) | ||
self.assertIsInstance(lat, float) | ||
|
@@ -117,10 +137,12 @@ def test_2d_location(self): | |
self.assertEquals(lng, self.gps_inf) | ||
|
||
def test_3a_delete_all(self): | ||
time.sleep(20) | ||
total, deleted = core.delete_all(self.db, db_only=True) | ||
self.assertEquals(total, deleted) | ||
|
||
def test_3b_location(self): | ||
time.sleep(20) | ||
avail = self.available_test() | ||
lat, lng = core.get_last_location(avail, self.db) | ||
self.assertIsInstance(lat, float) | ||
|
@@ -129,10 +151,12 @@ def test_3b_location(self): | |
self.assertEquals(lng, self.gps_inf) | ||
|
||
def test_3c_disable(self): | ||
time.sleep(20) | ||
code = core.disable(self.iface) | ||
self.assertEqual(code, 0) | ||
|
||
def test_scheme_all(self): | ||
time.sleep(20) | ||
schemes = core.scheme_all() | ||
for obj in schemes: | ||
iface, name = obj['interface'], obj['name'] | ||
|
@@ -143,13 +167,42 @@ def test_scheme_all(self): | |
|
||
options = obj['options'] | ||
self.assertIsInstance(options, dict) | ||
channel, psk, ssid = options['wireless-channel'], options['wpa-psk'], options['wpa-ssid'] | ||
self.assertIsInstance(channel, str) | ||
self.assertIsInstance(psk, str) | ||
self.assertIsInstance(ssid, str) | ||
self.assertTrue(len(channel) > 0) | ||
self.assertTrue(len(psk) > 0) | ||
self.assertTrue(len(ssid) > 0) | ||
channel, psk, ssid = options.get('wireless-channel'), options.get('wpa-psk'), options.get('wpa-ssid') | ||
if channel is not None: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some things to comment here:
|
||
self.assertIsInstance(channel, str) | ||
print("channel is defined") | ||
else: | ||
print("channel is not defined") | ||
|
||
if psk is not None: | ||
self.assertIsInstance(psk, str) | ||
print("psk is defined") | ||
else: | ||
print("psk is not defined") | ||
|
||
if ssid is not None: | ||
self.assertIsInstance(ssid, str) | ||
print("ssid is defined") | ||
else: | ||
print("ssid is not defined") | ||
|
||
if channel is not None: | ||
self.assertTrue(len(channel) > 0) | ||
print("channel is true") | ||
else: | ||
print("channel is false") | ||
|
||
if psk is not None: | ||
self.assertTrue(len(psk) > 0) | ||
print("psk is true") | ||
else: | ||
print("psk is false") | ||
|
||
if ssid is not None: | ||
self.assertTrue(len(ssid) > 0) | ||
print("ssid is true") | ||
else: | ||
print("ssid is false") | ||
|
||
|
||
if __name__ == '__main__': | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not leaving just the more "fixed" version git+https://github.com/martel-innovate/wifi.git@rpi-fix ?
there should be only one line per each module in the requirements.txt