function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Lucky A 8Lucky A 8 

Hai, I want to move Password Based Login transaction security policy from FT to Production. My event type is Login. If any one of you have done this before, could you please provide me the test class.

Hai,

I want to move Password Based Login transaction security policy from FT to Production. My event type is Login. If any one of you have done this before, could you please provide me the test class.

Thanks,
Lucky
Raj VakatiRaj Vakati
Hi Lucky ,
You can migrate bt using ANT .
 
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>MySecurityPolicy</members>
        <name>TransactionSecurityPolicy</name>
    </types>
    <version>35.0</version>
</Package>

Test Class is here below . 
@isTest
public class TestLoginPolicey {
  public static testMethod void testIsAndroid() {

    /* Create a history object that has Platform = Android 4. */
    LoginHistory loginHistoryObj = new LoginHistory();
    loginHistoryObj.Platform = 'Android 4';

    /* Create a map for the event we’re going to build. */
    Map<String, String> eventData = new Map<String, String>();

    /* Insert the LoginHistoryId into the event data map. */
    insert loginHistoryObj;
    eventData.put('LoginHistoryId', loginHistoryObj.id);

    TxnSecurity.Event e = new TxnSecurity.Event(
      '00Dxxx123123123', /* organizationId */
      '005xxx123123123', /* userId */
      'AuthSession', /* entityName */
      'Login', /* action */
      'LoginHistory', /* resourceType */
      '01pR00000009D2H', /* entityId */
      Datetime.newInstance(2016, 2, 15), /* timeStamp */
      eventData); /* data - Map with info about this event. */

    LoginPolicyCondition condition =
      new LoginPolicyCondition();

    System.assertEquals(true, condition.evaluate(e));
  }
}