-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'staging' of https://github.com/bastoscorp/pvAlert into …
…staging
- Loading branch information
Showing
10 changed files
with
987 additions
and
44 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ on: | |
pull_request: | ||
branches: [ "main", "staging" ] | ||
|
||
|
||
permissions: | ||
contents: read | ||
|
||
|
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
Binary file not shown.
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,45 @@ | ||
import ipaddress | ||
import os | ||
from os.path import exists as file_exists | ||
|
||
import sys | ||
sys.path.insert(0, '../pvAlert') | ||
|
||
from config.config import Config | ||
from business.actionDevicePhilipsHue import ActionDevicePhilipsHue | ||
|
||
# should have a configured philips hue tor testing | ||
|
||
dirname = os.path.dirname(__file__) | ||
#get parrent config file | ||
home = os.path.dirname(dirname) | ||
conffile = os.path.join(home, 'config.ini') | ||
conf = Config(conffile) | ||
adm_hue = ActionDevicePhilipsHue(conf) | ||
|
||
def test_save_cache(): | ||
if adm_hue.bridge_ip != None: | ||
adm_hue.save_cache_data() | ||
file = conf.hue_cache_file | ||
assert file_exists(file) | ||
else: | ||
assert False | ||
|
||
def test_load_cache(): | ||
adm_hue.bridge_ip = None | ||
adm_hue.load_cache_data() | ||
# test if it is an v4 ip address | ||
assert ipaddress.ip_address(adm_hue.bridge_ip) | ||
|
||
def test_bridge_ip_discovery(): | ||
adm_hue.bridge_ip = None | ||
adm_hue.discover_ip() | ||
# test if it is an v4 ip address | ||
assert ipaddress.ip_address(adm_hue.bridge_ip) | ||
|
||
|
||
def test_get_device_id_KO(): | ||
hue_id = adm_hue.get_device_id("azerzrtzretzertezrt") | ||
assert hue_id == None | ||
|
||
|
Oops, something went wrong.