|
| 1 | +import unittest |
| 2 | + |
| 3 | +from helpers._os_lib import CleanupFolder, runAUT, FileExists |
| 4 | +from helpers._tns_lib import iosRuntimeSymlinkPath, \ |
| 5 | + tnsPath, Prepare, CreateProjectAndAddPlatform |
| 6 | + |
| 7 | + |
| 8 | +class Plugins_OSX_Sandbox_Pods(unittest.TestCase): |
| 9 | + |
| 10 | + def setUp(self): |
| 11 | + |
| 12 | + print "" |
| 13 | + print "#####" |
| 14 | + print self.id() |
| 15 | + print "#####" |
| 16 | + print "" |
| 17 | + |
| 18 | + runAUT("rm -rf ~/Library/Developer/Xcode/DerivedData/*") # Delete derived data |
| 19 | + CleanupFolder('./TNS_App') |
| 20 | + |
| 21 | + def tearDown(self): |
| 22 | + pass |
| 23 | + |
| 24 | + def test_001_PluginAdd_Sandbox_Pod_CanWriteInAppFolder(self): |
| 25 | + CreateProjectAndAddPlatform(projName="TNS_App", platform="ios", frameworkPath=iosRuntimeSymlinkPath, symlink=True) |
| 26 | + |
| 27 | + output = runAUT(tnsPath + " plugin add QA-TestApps/CocoaPods/nativescript-ios-working-with-sandbox-plugin --path TNS_App") |
| 28 | + assert ("Successfully installed plugin nativescript-ios-working-with-sandbox-plugin." in output) |
| 29 | + |
| 30 | + output = runAUT("cat TNS_App/package.json") |
| 31 | + assert ("nativescript-ios-working-with-sandbox-plugin" in output) |
| 32 | + |
| 33 | + output = Prepare(platform="ios", path="TNS_App") |
| 34 | + assert ("Successfully prepared plugin nativescript-ios-working-with-sandbox-plugin for ios." in output) |
| 35 | + |
| 36 | + output = runAUT("cat TNS_App/platforms/ios/TNSApp/app/I_MADE_THIS_FILE.txt") |
| 37 | + assert ("content" in output) |
| 38 | + |
| 39 | + def test_401_PluginAdd_Sandbox_Pod_CanNotWriteOutsideAppFolder(self): |
| 40 | + CreateProjectAndAddPlatform(projName="TNS_App", platform="ios", frameworkPath=iosRuntimeSymlinkPath, symlink=True) |
| 41 | + |
| 42 | + output = runAUT(tnsPath + " plugin add QA-TestApps/CocoaPods/nativescript-ios-fail-with-sandbox-plugin --path TNS_App") |
| 43 | + assert ("Successfully installed plugin nativescript-ios-fail-with-sandbox-plugin." in output) |
| 44 | + |
| 45 | + output = runAUT("cat TNS_App/package.json") |
| 46 | + assert ("nativescript-ios-fail-with-sandbox-plugin" in output) |
| 47 | + |
| 48 | + output = Prepare(platform="ios", path="TNS_App") |
| 49 | + assert ("Successfully prepared plugin nativescript-ios-fail-with-sandbox-plugin for ios." in output) |
| 50 | + |
| 51 | + assert ("sh: ../I_MADE_THIS_FILE.txt: Operation not permitted" in output) |
| 52 | + assert not FileExists("TNS_App/platforms/I_MADE_THIS_FILE.txt") |
0 commit comments