Commit Graph

70 Commits

Author SHA1 Message Date
Adam Hill 8ca4c66e3c
make smarter assertions rathe than `largestring not in string`
Signed-off-by: Adam Hill <adam@diginc.us>
2018-07-12 00:03:25 -05:00
bcambl fff31558a0 assert REMI repository is not installed for Fedora
- fix whiptail mock comments to clarify continue vs cancel

Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-07-08 14:02:31 -06:00
bcambl 09d40679c0 add test for unsupported distro checking
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-07-06 10:07:43 -06:00
bcambl 5ca2ad6148 move test globals & mock commands to conftest
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-07-05 18:10:43 -06:00
bcambl 40537e1522 python linting: missing whitespace after ',' (E231)
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-07-03 00:43:24 -06:00
bcambl 064a75b21b python linting: missing whitespace around operator (E225)
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-07-03 00:43:18 -06:00
bcambl 79232d02c9 python linting: 'pytest' imported but unused (F401)
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-07-03 00:30:00 -06:00
bcambl 9bd4986781 python linting: whitespace before ':' (E203)
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-07-03 00:21:57 -06:00
bcambl c3d443aaff python linting: lines > 79 characters (E501)
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-07-03 00:09:56 -06:00
bcambl da3dfd0998 python linting: missing whitespace after ':' (E231)
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-07-02 15:25:51 -06:00
bcambl 4468d81472 python linting: 2 lines prior to defs (E302)
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-07-02 14:54:19 -06:00
bcambl 9d3d33b6a2 add tests for selinux checking
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-06-26 00:09:30 -06:00
Adam Warner 8cf8da4c78
- Check file /etc/pihole/ftlbranch for current FTL branch, download from github if master, or pi-hole.net if other
- Check if downloaded binary file can resolve queries, if so stop and disable dnsmasq
- Add service_disable function
- Add dependency libcap2-bin on debian to enable setcap. Need to check other distos
-Always download FTL binary if /etc/pihole/ftlbranch does not contain "master"
- Change some strings/variables that reference dnsmasq and change them to pihole/pihole-FTL

Signed-off-by: Adam Warner <adamw@rner.email>
2018-03-06 18:44:57 +00:00
WaLLy3K 26afe04926 Remove index.js test 2017-09-19 01:04:04 +10:00
Adam Warner 42b5574f9b
remove no longer needed tests
Signed-off-by: Adam Warner <adamw@rner.email>
2017-09-09 19:41:05 +01:00
WaLLy3K fdf2649f2f Clean up known remaining colour output issues (#1613)
* Print newline on error message

* Output last three lines of error if update fails

* Consistent error messages & housekeeping

* Add shellcheck directive to ignore COL_TABLE
* Quoted and braced variables for codebase consistency
* Escaped newlines correctly
* Made error messages consistent (indenting and wording)
* Removed consecutive echos

* Conditional formatting consistency

* Braced, quoted and used [[ on conditionals

* Fix specific ShellCheck issues

* Fixed issues that could be safely changed without extensive testing

* Update SELinux whiptail behaviour & more

* Colourised some strings
* Fixed multiple line string indenting
* Made output consistent with existing codebase
* Removed sequential echos
* Make SELinux whiptail use "--defaultno", and change text wording

* Add help text for hostrecord, and colourise output

* this should fix the tests...

Signed-off-by: Adam Warner <adamw@rner.email>

* revert changes to `update_package_cache()` to prove tests

Signed-off-by: Adam Warner <adamw@rner.email>
2017-07-26 18:00:08 +01:00
Mcat12 b09c660833 Always process DNS and DHCP settings in installer (#1630)
* Always process DNS and DHCP settings in installer

* Make sure dnsmasq config exists before modifying it

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>

* Make sure the dnsmasq config directory exists

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>

* Only remove the DHCP config if it exists (fixes tests, hopefully)

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-07-26 17:15:23 +01:00
Adam Warner bf70c2c660
initial changes to tests to take into account changes to strings
Signed-off-by: Adam Warner <adamw@rner.email>
2017-07-12 22:57:57 +01:00
Adam Warner 536585b846 Colourise Core Output Text (#1471)
* Define colours within COL_TABLE
* Do not output colours for non-terminal instances
* Removed ":::"
* Fixed indenting & spacing
* Made output consistent throughout project
* Reworded text to fit on standard 80 char wide Terminal screen
* Made 'sudo raspi-config' warning (insufficient disk space) only show on RPi
* Make "Installation/Update Complete" the final msg
* Remove redundant messages
* Simplify update available message
* Confirm user would like to begin uninstall
* If "git pull" string says "Already up-to-date.", place [i] before it
* Colour Temp/Interface output
* Made `pihole disable 5z` invalid
* Added error fallback if invalid argument (not s/m) is detected
* Quoted "$2" for consistency
* Updated help text
* L185/286: Replaced echo with redirect
* User agents for adblock.mahakala.is/adaway.org unnecessary 
* Print newline on confirmation of repository reset
* Add output to admin-related dnsmasq restarts
* Return error message for "pihole -q"
* Imply default checkout behaviour with y/N
* Fix uninstall failing to remove pihole user
* Print checkout 'git remote show origin' STDERR on new line
* Replaced checkout "AdminLTE" wording with "Web Admin"
2017-06-21 21:49:05 +10:00
DL6ER 939055f19c Revert "Add FTL tests to the test suite (#1510)" (#1519)
This reverts commit cf6a1ac9ad.
2017-06-05 13:51:13 +02:00
DL6ER cf6a1ac9ad Add FTL tests to the test suite (#1510)
* Add first version of FTL tests

* Wait one second to allow FTL to start up and analyze our mock log

* Add test_FTL_telnet_statistics

* Added test_FTL_telnet_top_clients

* Add test_FTL_telnet_top_domains
2017-06-04 13:23:56 +02:00
DL6ER 01e091fd17 Prefer ULA over GUA addresses [IPv6] (#1508)
* On installs with GUA and ULA's we should prefer ULA's as it's been demonstrated that GUA's can and often are rotated by ISPs. Fixes #1473

* Add test for link-local address detection

* Add ULA-only and GUA-only tests

* Add test_IPv6_GUA_ULA_test and test_IPv6_ULA_GUA_test

* Add ""

* Add mock_command_2 command that can mock a command with more than one argument (as "ip -6 address") and result multiple lines of results

* Make mock_command_2 more similar to the original mock_command

* Correct comments

* Fixed remaining comments

* Fixed one last comment...

* Fixed a comment...
2017-06-02 23:01:48 +02:00
georou 6c56665403 updated travis for new firewalld add service 2017-03-16 10:26:51 +11:00
Dan Schaper dcb9797f35
Tests changed to reflect `uname` calls.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2017-02-21 09:24:00 -08:00
DL6ER e9b50442fa
Remove test_FTL_support_files_installed as we create them using the init.d script as of now 2017-02-21 11:25:18 +01:00
Dan Schaper 02ea9b9abc
Check file path and permissions in one go.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2017-02-20 18:15:40 -08:00
Dan Schaper 4cd598ae10
Check support files installed and permissions.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2017-02-20 18:12:51 -08:00
Dan Schaper 8eeb8ad779
Check binary installed and functional.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2017-02-20 17:15:04 -08:00
Dan Schaper 70e876ee13
Download tests.
Make sure we download a binary and not just get the GitHub page.

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2017-02-20 11:11:16 -08:00
Dan Schaper 87edbeaf58
Factor out downloader from detector function.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2017-02-20 08:40:17 -08:00
Dan Schaper 339f95b00c
Change from `uname -m` to straight `arch`
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2017-02-20 08:13:46 -08:00
Dan Schaper e480c761cd
Merge remote-tracking branch 'origin/new/FTL-binary' into new/FTL-binary
# Conflicts:
#	test/test_automated_install.py
2017-02-20 07:25:34 -08:00
Dan Schaper 26c628f8a5
Mock ldd command response.
Test aarch64 detection

Arm v6/v7 little endian.

x86_64 native

Test aarch64 detection

Unknown platform detection.

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2017-02-20 07:22:25 -08:00
Dan Schaper 59d6907d71
Test aarch64 detection
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2017-02-20 06:34:57 -08:00
Dan Schaper b4450a3918
Mock ldd command response.
Test aarch64 detection

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2017-02-20 06:34:54 -08:00
Dan Schaper 7032be6049
Template for FTL engine type tests.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2017-02-20 06:34:40 -08:00
Dan Schaper 439999cb62
Last rule check. 2017-01-28 16:47:53 -08:00
Dan Schaper 409f76aa34
Error check. 2017-01-28 16:37:31 -08:00
Dan Schaper 54e2c6181a
Populate all required variables with a distro check. 2017-01-28 16:37:28 -08:00
Dan Schaper 2a5587f236
Test for failure. 2017-01-28 16:37:17 -08:00
Dan Schaper 2d18b2d784
Start test templates. 2017-01-28 16:37:04 -08:00
Dan Schaper d5587e32d0
Populated directory test 2017-01-27 21:41:14 -08:00
Dan Schaper 28eb348707
Individual Page tests 2017-01-27 21:41:05 -08:00
Dan Schaper 91bcc18e6a
Make full path to directory for pihole web page. 2017-01-27 21:40:52 -08:00
Dan Schaper 5b43f13935
Fresh install web page directory tests 2017-01-27 20:24:20 -08:00
Dan Schaper 0bbe0aed83
Last of the IPTables tests, new test rig is operating. 2017-01-24 20:09:10 -08:00
Dan Schaper b16f797317
`firewall-cmd --state` returns 0 on 'running' non 0 on 'not running',
so check retval and not text returned.

FirewallD conversion to multicall

IPTables test
2017-01-24 19:57:31 -08:00
Dan Schaper 4bb71ae046
IPtables tests.
mock commands for iptables check.

Test setting IPTables ruleset.

Test setting IPTables ruleset.

Test for already configured IPTables rules.

Test for addition of iptables rules.

Can only mock so deep in the commands.
2017-01-24 13:42:51 -08:00
Dan Schaper 679b098aa7
No firewall enabled test. 2017-01-24 12:04:45 -08:00
Dan Schaper e0e88fdb52
Start IPTables test, get baseline for commands in the container. See
what we have to mock to start testing.
2017-01-24 11:58:22 -08:00