gitlab.com/evatix-go/core@v1.3.55/tests/integratedtests/chmodhelpertests/VerifyRwxChmodUsingRwxInstructions_test.go (about)

     1  package chmodhelpertests
     2  
     3  import (
     4  	"testing"
     5  
     6  	. "github.com/smartystreets/goconvey/convey"
     7  	"gitlab.com/evatix-go/core/coretests"
     8  	"gitlab.com/evatix-go/core/errcore"
     9  
    10  	"gitlab.com/evatix-go/core/chmodhelper"
    11  	"gitlab.com/evatix-go/core/tests/testwrappers/chmodhelpertestwrappers"
    12  )
    13  
    14  func Test_VerifyRwxChmodUsingRwxInstructions_Unix(t *testing.T) {
    15  	coretests.SkipOnWindows(t)
    16  
    17  	// Setup
    18  	createPathInstructions := chmodhelpertestwrappers.CreatePathInstruction2
    19  	chmodhelper.CreateDirFilesWithRwxPermissionsMust(
    20  		true,
    21  		&createPathInstructions)
    22  
    23  	for caseIndex, testCase := range chmodhelpertestwrappers.VerifyRwxChmodUsingRwxInstructionsTestCases {
    24  		// Arrange
    25  		expectationMessage := testCase.ExpectedErrorMessage
    26  		executor, err := chmodhelper.ParseRwxInstructionToExecutor(&testCase.RwxInstruction)
    27  
    28  		errcore.SimpleHandleErr(err, "")
    29  
    30  		// Act
    31  		actualErr := executor.VerifyRwxModifiersDirect(
    32  			false,
    33  			testCase.Locations...)
    34  
    35  		expectation := &errcore.ExpectationMessageDef{
    36  			CaseIndex:      caseIndex,
    37  			FuncName:       "Test_VerifyRwxChmodUsingRwxInstructions_Unix",
    38  			TestCaseName:   "VerifyRwxChmodUsingRwxInstructionsTestCases",
    39  			When:           testCase.Header,
    40  			Expected:       expectationMessage,
    41  			IsNonWhiteSort: true,
    42  		}
    43  
    44  		// Assert
    45  		Convey(testCase.Header, t, func() {
    46  			isEqual := coretests.IsErrorNonWhiteSortedEqual(
    47  				true,
    48  				actualErr,
    49  				expectation)
    50  
    51  			So(isEqual, ShouldBeTrue)
    52  		})
    53  	}
    54  }