@ -17,14 +17,15 @@
from units . compat import unittest
from units . compat import unittest
from ansible . modules . system import interfaces_file
from ansible . modules . system import interfaces_file
import os
import json
import io
import inspect
from shutil import copyfile , move
from shutil import copyfile , move
import difflib
import difflib
import tempfile
import inspect
import io
import json
import os
import re
import shutil
import shutil
import tempfile
class AnsibleFailJson ( Exception ) :
class AnsibleFailJson ( Exception ) :
@ -50,8 +51,13 @@ golden_output_path = os.path.join(os.path.dirname(__file__), 'fixtures', 'golden
class TestInterfacesFileModule ( unittest . TestCase ) :
class TestInterfacesFileModule ( unittest . TestCase ) :
def getTestFiles ( self ) :
def getTestFiles ( self , include_filter = None , exclude_filter = None ) :
return next ( os . walk ( fixture_path ) ) [ 2 ]
flist = next ( os . walk ( fixture_path ) ) [ 2 ]
if include_filter :
flist = filter ( lambda x : re . match ( include_filter , x ) , flist )
if exclude_filter :
flist = filter ( lambda x : not re . match ( exclude_filter , x ) , flist )
return flist
def compareFileToBackup ( self , path , backup ) :
def compareFileToBackup ( self , path , backup ) :
with open ( path ) as f1 :
with open ( path ) as f1 :