<commit_before>------------- --------------------------------------------------------------------------------
-- Requirement summary: 
--     [RegisterAppInterface] Assign existing policies to the application which appID exists in LocalPT 
--
-- Description: 
--     SDL should apply Local PT permissions existing in "<appID>" from "app_policies" section 
--     to this application in case it registers (sends RegisterAppInterface request) with the appID 
--     that exists in Local Policy Table.
--
-- Preconditions:
--     1. appID="456_abc" is not registered to SDL yet
--     2. SDL.OnStatusUpdate = "UP_TO_DATE"
-- Steps:
--     1. Register new application with appID="456_abc"
--        Default permissions are assigned in app_policies: "456_abc": "default"
--        "SetGlobalProperties" RPC is allowed for HMILevel = "NONE"
--     2. Send "SetGlobalProperties" RPC and verifies that RPC is allowed
--     3. Initiate a Policy Table Update and remove permission for "SetGlobalProperties" RPC 
--        if HMILevel = "NONE" for "456_abc" application
--     4. Send "SetGlobalProperties" RPC again and verifies RPC's respond status
--
-- Expected result:
--     Status of response: sucess = false, resultCode = "DISALLOWED"

---------------------------------------------------------------------------------------------

--[[ General configuration parameters ]]
  config.deviceMAC = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0"

--[[ Required Shared libraries ]]
  local mobileSession = require("mobile_session")
  local common = require("user_modules/shared_testcases/testCasesForPolicyAppIdManagament")  
  local commonFunctions = require("user_modules/shared_testcases/commonFunctions")
  local commonSteps = require("user_modules/shared_testcases/commonSteps")  

--[[ General Precondition before ATF start ]]  
  commonFunctions:SDLForceStop()  
  commonSteps:DeleteLogsFileAndPolicyTable()

--[[ General Settings for configuration ]]
  Test = require("connecttest") 
  require("user_modules/AppTypes")

--[[ Preconditions ]]  
  commonFunctions:newTestCasesGroup("Preconditions")
  function Test:UpdatePolicy()
    common:updatePolicyTable(self, "files/jsons/Policies/appID_Management/ptu_0.json")
  end

  function Test:StartNewSession()
    self.mobileSession2 = mobileSession.MobileSession(self, self.mobileConnection)
    self.mobileSession2:StartService(7)
  end

--[[ Test ]]
  commonFunctions:newTestCasesGroup("Test")
  function Test:RegisterNewApp()  <commit_msg>Added CheckPolicyFlagAfterBuild in precondition<commit_after>------------- --------------------------------------------------------------------------------
-- Requirement summary: 
--     [RegisterAppInterface] Assign existing policies to the application which appID exists in LocalPT 
--
-- Description: 
--     SDL should apply Local PT permissions existing in "<appID>" from "app_policies" section 
--     to this application in case it registers (sends RegisterAppInterface request) with the appID 
--     that exists in Local Policy Table.
--
-- Preconditions:
--     1. appID="456_abc" is not registered to SDL yet
--     2. SDL.OnStatusUpdate = "UP_TO_DATE"
-- Steps:
--     1. Register new application with appID="456_abc"
--        Default permissions are assigned in app_policies: "456_abc": "default"
--        "SetGlobalProperties" RPC is allowed for HMILevel = "NONE"
--     2. Send "SetGlobalProperties" RPC and verifies that RPC is allowed
--     3. Initiate a Policy Table Update and remove permission for "SetGlobalProperties" RPC 
--        if HMILevel = "NONE" for "456_abc" application
--     4. Send "SetGlobalProperties" RPC again and verifies RPC's respond status
--
-- Expected result:
--     Status of response: sucess = false, resultCode = "DISALLOWED"

---------------------------------------------------------------------------------------------

--[[ General configuration parameters ]]
  config.deviceMAC = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0"

--[[ Required Shared libraries ]]
  local mobileSession = require("mobile_session")
  local common = require("user_modules/shared_testcases/testCasesForPolicyAppIdManagament")  
  local commonFunctions = require("user_modules/shared_testcases/commonFunctions")
  local commonSteps = require("user_modules/shared_testcases/commonSteps")  
  local testCasesForBuildingSDLPolicyFlag = require('user_modules/shared_testcases/testCasesForBuildingSDLPolicyFlag')

--[[ General Precondition before ATF start ]]  
  testCasesForBuildingSDLPolicyFlag:CheckPolicyFlagAfterBuild("EXTERNAL_PROPRIETARY")
  commonFunctions:SDLForceStop()  
  commonSteps:DeleteLogsFileAndPolicyTable()

--[[ General Settings for configuration ]]
  Test = require("connecttest") 
  require("user_modules/AppTypes")

--[[ Preconditions ]]  
  commonFunctions:newTestCasesGroup("Preconditions")
  function Test:UpdatePolicy()
    common:updatePolicyTable(self, "files/jsons/Policies/appID_Management/ptu_0.json")
  end

  function Test:StartNewSession()
    self.mobileSession2 = mobileSession.MobileSession(self, self.mobileConnection)
    self.mobileSession2:StartService(7)
  end

--[[ Test ]]
  commonFunctions:newTestCasesGroup("Test")
  function Test:RegisterNewApp()  
{'fraction_non_alphanumeric': 0.1609895337773549, 'fraction_numerical': 0.02702188392007612, 'mean_word_length': 3.1223529411764708, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5837192', 'n_tokens_mistral': 1518, 'n_tokens_neox': 1428, 'n_words': 367}