apiKey = options.apikey projectIdentifier = options.identifier print "Evaluating", options.path if not os.path.exists(options.path): print "Path not found: " + options.path sys.exit(1) isDirectory = os.path.isdir(options.path) isFile = os.path.isfile(options.path) if isDirectory: pathToStringsXml = helper.locateFile("strings.xml", options.path) if not helper.isValidAndroidResourcePath(pathToStringsXml): print "Not a valid Android resources directory" sys.exit(1) elif isFile: pathToStringsXml = options.path if not helper.isValidAndroidResourcePath(pathToStringsXml): print "Not a valid Android resource file" sys.exit(1) if options.action == "update": if not helper.IsDefaultStringsXml(pathToStringsXml): print "Please only specify the default '/res/values/strings.xml' for upload" sys.exit(1)
projectIdentifier = row[1] apiKey = row[2] print "Evaluating", options.path if not os.path.exists(options.path): print "Path not found: " + options.path sys.exit(1) isDirectory = os.path.isdir(options.path) isFile = os.path.isfile(options.path) if isDirectory: pathToStringsXml = helper.locateFile("strings.xml", options.path) if not helper.isValidAndroidResourcePath(pathToStringsXml): print "Not a valid Android resources directory" sys.exit(1) elif isFile: pathToStringsXml = options.path if not helper.isValidAndroidResourcePath(pathToStringsXml): print "Not a valid Android resource file" sys.exit(1) if options.action == "update": if not helper.IsDefaultStringsXml(pathToStringsXml): print "Please only specify the default '/res/values/strings.xml' for upload" sys.exit(1)
def test_isValidAndroidResourcePath_DeValuesFolder_ReturnsFalse(self): p = helper.isValidAndroidResourcePath("/hello/res/devalues/strings.xml") self.assertFalse(p)
def test_isValidAndroidResourcePath_PTBRValueIsValidPath_ReturnsTrue(self): p = helper.isValidAndroidResourcePath("/hello/res/values-pt-rBR/strings.xml") self.assertTrue(p)
def test_isValidAndroidResourcePath_FrenchValuesIsValidPath_ReturnsTrue(self): p = helper.isValidAndroidResourcePath("/hello/res/values-fr/strings.xml") self.assertTrue(p)
def test_isValidAndroidResourcePath_ContainResValuesStringsXml_ReturnsTrue(self): p = helper.isValidAndroidResourcePath("/hello/res/values/strings.xml") self.assertTrue(p)
def test_isValidAndroidResourcePath_NonePath_ReturnsFalse(self): p = helper.isValidAndroidResourcePath(None) self.assertFalse(p)