mirror of
https://github.com/netbox-community/netbox.git
synced 2026-03-21 20:18:38 -06:00
add docs and tests
This commit is contained in:
@@ -43,7 +43,7 @@ A set of rules (one per line) identifying files or paths to ignore during synchr
|
||||
| `README` | Ignore any files named `README` |
|
||||
| `*.txt` | Ignore any files with a `.txt` extension |
|
||||
| `data???.json` | Ignore e.g. `data123.json` |
|
||||
| `subdir/*` | Ignore all files directly within `subdir/` |
|
||||
| `subdir/*` | Ignore all files within `subdir/` |
|
||||
| `subdir/*/*` | Ignore all files one level deep within `subdir/` |
|
||||
| `*/dev/*` | Ignore files inside any directory named `dev/` |
|
||||
|
||||
|
||||
@@ -10,6 +10,26 @@ from dcim.models import Device, Location, Site
|
||||
from netbox.constants import CENSOR_TOKEN, CENSOR_TOKEN_CHANGED
|
||||
|
||||
|
||||
class DataSourceIgnoreRulesTestCase(TestCase):
|
||||
|
||||
def test_no_ignore_rules(self):
|
||||
ds = DataSource(ignore_rules='')
|
||||
self.assertFalse(ds._ignore('README.md'))
|
||||
self.assertFalse(ds._ignore('subdir/file.py'))
|
||||
|
||||
def test_ignore_by_filename(self):
|
||||
ds = DataSource(ignore_rules='*.txt')
|
||||
self.assertTrue(ds._ignore('notes.txt'))
|
||||
self.assertTrue(ds._ignore('subdir/notes.txt'))
|
||||
self.assertFalse(ds._ignore('notes.py'))
|
||||
|
||||
def test_ignore_by_subdirectory(self):
|
||||
ds = DataSource(ignore_rules='dev/*')
|
||||
self.assertTrue(ds._ignore('dev/README.md'))
|
||||
self.assertTrue(ds._ignore('dev/script.py'))
|
||||
self.assertFalse(ds._ignore('prod/script.py'))
|
||||
|
||||
|
||||
class DataSourceChangeLoggingTestCase(TestCase):
|
||||
|
||||
def test_password_added_on_create(self):
|
||||
|
||||
Reference in New Issue
Block a user