Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1 

2import sys 

3import os 

4import pytest 

5 

6sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../../../") 

7from sdc_etl_libs.api_helpers.apis.ExactTarget.ExactTarget import ExactTarget 

8 

9 

10def test_filter_string(mocker): 

11 

12 mocker.patch('sdc_etl_libs.api_helpers.API.API.get_credentials', return_value={"api_key": "this"}) 

13 mocker.patch('FuelSDK.ET_Client', return_value=None) 

14 

15 et = ExactTarget() 

16 date_string = '2018-04-29T17:45:25Z' 

17 

18 date_property_ = "test" 

19 from_dt = "2018-04-29T17:40:25" 

20 to_dt = "2018-04-29T17:45:25" 

21 

22 from_filter = {'Property': date_property_, 

23 'SimpleOperator': 'greaterThan', 

24 'DateValue': from_dt} 

25 to_filter = {'Property': date_property_, 

26 'SimpleOperator': 'lessThanOrEqual', 

27 'DateValue': to_dt} 

28 date_filter = {'LeftOperand': from_filter, 

29 'LogicalOperator': 'AND', 

30 'RightOperand': to_filter} 

31 

32 test_filter = et.get_filter_for_last_n_minutes("test", 5, date_string) 

33 

34 assert date_filter == test_filter