예제 #1
0
    def test_commandUpload_Callback_Approved(self):
        ud = UploadData("path", "name", "type")
        ud.setApproveContent("true")
        ud.setCallbackUrl("smartling.com")

        api = FileApiBase("host", "apiKey", "projectId")
        api.uploadMultipart = self.mock_uploadMultipart
        params = api.commandUpload(ud)

        assert_equal(len(params), 5)
        assert_equal(params[Params.APPROVED], "true")
        assert_equal(params[Params.CALLBACK_URL], "smartling.com")
예제 #2
0
    def test_commandUpload(self):
        ud = UploadData("path", "name", "type")

        api = FileApiBase("host", "apiKey", "projectId")
        api.uploadMultipart = self.mock_uploadMultipart
        params = api.commandUpload(ud)

        assert_equal(len(params), 4)
        assert_equal(params[Params.FILE_URI], "name")
        assert_equal(params[Params.FILE_TYPE], "type")
        assert_equal(params[Params.FILE_PATH], "pathname")
        assert_equal(params[Params.APPROVED], "false")
예제 #3
0
    def test_commandUpload_Directives(self):
        ud = UploadData("path", "name", "type")
        ud.setApproveContent("true")
        ud.setCallbackUrl("smartling.com")
        ud.addDirective(
            SmartlingDirective("placeholder_format_custom", "\[.+?\]"))
        ud.addDirective(SmartlingDirective("placeholder_format", "IOS"))

        api = FileApiBase("host", "apiKey", "projectId")
        api.uploadMultipart = self.mock_uploadMultipart
        params = api.commandUpload(ud)

        assert_equal(len(params), 7)
        assert_equal(params["smartling.placeholder_format_custom"], "\[.+?\]")
        assert_equal(params["smartling.placeholder_format"], "IOS")