реализовал тесты на получение имени профиля при установке
This commit is contained in:
parent
7c11a708f0
commit
826140a7eb
|
|
@ -5,7 +5,10 @@ from parsers.InstallProfileParser import InstallProfileParser
|
|||
|
||||
|
||||
class InstallProfileCommandBuilder:
|
||||
def __init__(self):
|
||||
def __init__(self, profileFilePrefix):
|
||||
assert profileFilePrefix is not None
|
||||
|
||||
self.profileFilePrefix = profileFilePrefix
|
||||
self.profileStorageDir = '~/Library/MobileDevice/Provisioning Profiles/'
|
||||
|
||||
def isInstallProfile(self, line):
|
||||
|
|
@ -31,7 +34,13 @@ class InstallProfileCommandBuilder:
|
|||
return command
|
||||
|
||||
def getDestinationPath(self, sourcePath):
|
||||
profileFileName = os.path.basename(sourcePath)
|
||||
destination = os.path.join(self.profileStorageDir, profileFileName)
|
||||
dstProfileFileName = self.fetchDstFileName(sourcePath)
|
||||
dstProfilePath = os.path.join(self.profileStorageDir, dstProfileFileName)
|
||||
|
||||
return destination
|
||||
return dstProfilePath
|
||||
|
||||
def fetchDstFileName(self, srcFilePath):
|
||||
profileFileName = os.path.basename(srcFilePath)
|
||||
profileFileName = '{0}.{1}'.format(self.profileFilePrefix, profileFileName)
|
||||
|
||||
return profileFileName
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
import unittest
|
||||
from CommandBuilders.InstallProfileCommandBuilder import InstallProfileCommandBuilder
|
||||
|
||||
|
||||
class TestInstallProfileBuilder(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.prefix = 'MyProject'
|
||||
self.builder = InstallProfileCommandBuilder(self.prefix)
|
||||
|
||||
def test_dstFileName(self):
|
||||
dstFileName = self.builder.fetchDstFileName('/Some/Path/MyProfile.ext')
|
||||
self.assertEqual(dstFileName, '{0}.MyProfile.ext'.format(self.prefix))
|
||||
|
||||
def test_dstPath(self):
|
||||
dstPath = self.builder.getDestinationPath('/Some/Path/MyProfile.ext')
|
||||
self.assertEqual('~/Library/MobileDevice/Provisioning Profiles/{0}.MyProfile.ext'.format(self.prefix), dstPath)
|
||||
Loading…
Reference in New Issue