Skip to content

Commit

Permalink
Add sandbox-pod tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vasil Chimev authored and Vasil Chimev committed Oct 29, 2015
1 parent 3799f6c commit 5eb6457
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
52 changes: 52 additions & 0 deletions tests/plugins_osx_sandbox_pods.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import unittest

from helpers._os_lib import CleanupFolder, runAUT, FileExists
from helpers._tns_lib import iosRuntimeSymlinkPath, \
tnsPath, Prepare, CreateProjectAndAddPlatform


class Plugins_OSX_Sandbox_Pods(unittest.TestCase):

def setUp(self):

print ""
print "#####"
print self.id()
print "#####"
print ""

runAUT("rm -rf ~/Library/Developer/Xcode/DerivedData/*") # Delete derived data
CleanupFolder('./TNS_App')

def tearDown(self):
pass

def test_001_PluginAdd_Sandbox_Pod_CanWriteInAppFolder(self):
CreateProjectAndAddPlatform(projName="TNS_App", platform="ios", frameworkPath=iosRuntimeSymlinkPath, symlink=True)

output = runAUT(tnsPath + " plugin add QA-TestApps/CocoaPods/nativescript-ios-working-with-sandbox-plugin --path TNS_App")
assert ("Successfully installed plugin nativescript-ios-working-with-sandbox-plugin." in output)

output = runAUT("cat TNS_App/package.json")
assert ("nativescript-ios-working-with-sandbox-plugin" in output)

output = Prepare(platform="ios", path="TNS_App")
assert ("Successfully prepared plugin nativescript-ios-working-with-sandbox-plugin for ios." in output)

output = runAUT("cat TNS_App/platforms/ios/TNSApp/app/I_MADE_THIS_FILE.txt")
assert ("content" in output)

def test_401_PluginAdd_Sandbox_Pod_CanNotWriteOutsideAppFolder(self):
CreateProjectAndAddPlatform(projName="TNS_App", platform="ios", frameworkPath=iosRuntimeSymlinkPath, symlink=True)

output = runAUT(tnsPath + " plugin add QA-TestApps/CocoaPods/nativescript-ios-fail-with-sandbox-plugin --path TNS_App")
assert ("Successfully installed plugin nativescript-ios-fail-with-sandbox-plugin." in output)

output = runAUT("cat TNS_App/package.json")
assert ("nativescript-ios-fail-with-sandbox-plugin" in output)

output = Prepare(platform="ios", path="TNS_App")
assert ("Successfully prepared plugin nativescript-ios-fail-with-sandbox-plugin for ios." in output)

assert ("sh: ../I_MADE_THIS_FILE.txt: Operation not permitted" in output)
assert not FileExists("TNS_App/platforms/I_MADE_THIS_FILE.txt")
2 changes: 2 additions & 0 deletions tns_tests_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from tests.plugins_osx import Plugins_OSX
from tests.plugins_osx_libs import Plugins_OSX_Libs
from tests.plugins_osx_pods import Plugins_OSX_Pods
from tests.plugins_osx_sandbox_pods import Plugins_OSX_Sandbox_Pods
from tests.prepare_linux import Prepare_Linux
from tests.prepare_osx import Prepare_OSX
from tests.run_linux import Run_Linux
Expand Down Expand Up @@ -113,6 +114,7 @@ def RunTests():
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(Library_OSX))
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(Plugins_OSX_Libs))
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(Plugins_OSX_Pods))
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(Plugins_OSX_Sandbox_Pods))

if ('TESTRUN' in os.environ) and ("FULL" in os.environ['TESTRUN']):
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(Deploy_Linux))
Expand Down

0 comments on commit 5eb6457

Please sign in to comment.