Module ImportFrom alias ImportFrom alias ImportFrom alias alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias Assign NameStore Call NameLoad Str Str ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body With Call NameLoad Str keyword ListLoad Call NameLoad keyword Num keyword Str NameStore body Assign NameStore Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str With Call NameLoad Str keyword Call NameLoad Str NameStore body With Call AttributeLoad NameLoad attr NameLoad body Expr Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num With Call AttributeLoad NameLoad attr NameLoad body Expr Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str With Call NameLoad Str keyword ListLoad Call NameLoad keyword Num keyword Str NameStore body With Call AttributeLoad NameLoad attr NameLoad body Expr Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num With Call AttributeLoad NameLoad attr NameLoad body Expr Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str With Call NameLoad Str keyword Call NameLoad Str NameStore body With Call AttributeLoad NameLoad attr NameLoad body Expr Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num With Call AttributeLoad NameLoad attr NameLoad body Expr Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num decorator_list FunctionDef arguments args NameParam defaults body With Call NameLoad Str keyword Call NameLoad Str NameStore body With Call AttributeLoad NameLoad attr NameLoad body Expr Call NameLoad Str Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num With Call AttributeLoad NameLoad attr NameLoad body Expr Call NameLoad Str Str keyword NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num decorator_list decorator_list
N/A collections namedtuple mock patch requests.exceptions Timeout ConnectionError django.core.cache cache django.test SimpleTestCase corehq.apps.repeaters.models simple_post_with_cached_timeout corehq.apps.repeaters.exceptions RequestConnectionError N/A MockResponse N/A namedtuple MockResponse status_code reason SimplePostCacheTest N/A SimpleTestCase N/A setUp N/A N/A self N/A N/A N/A N/A N/A cache clear N/A tearDown N/A N/A self N/A N/A N/A N/A N/A cache clear N/A test_simple_post_with_cached_timeout_success N/A N/A self N/A N/A N/A N/A patch corehq.apps.repeaters.models.simple_post side_effect N/A N/A MockResponse status_code 200 reason No reason mock_post N/A N/A resp N/A simple_post_with_cached_timeout abc http://google.com N/A N/A N/A self assertEqual N/A mock_post call_count 1 N/A N/A N/A self assertEqual N/A resp status_code 200 N/A test_simple_post_with_cached_timeout_error N/A N/A self N/A N/A N/A 
        Ensures that when a post is made to the same URL that has timed out previous
        in the last hour, it will not make another post request
         N/A N/A patch corehq.apps.repeaters.models.simple_post side_effect N/A Timeout Timeout! mock_post N/A N/A N/A N/A self assertRaises RequestConnectionError N/A N/A N/A simple_post_with_cached_timeout abc http://google.com N/A N/A N/A self assertEqual N/A mock_post call_count 1 N/A N/A N/A self assertRaises RequestConnectionError N/A N/A N/A simple_post_with_cached_timeout abc http://google.com N/A N/A N/A self assertEqual N/A mock_post call_count 1 N/A test_simple_post_with_cached_timeout_bad_http_response N/A N/A self N/A N/A N/A 
        Ensure that when an http response returns outside 200 or 300 response it caches
         N/A N/A patch corehq.apps.repeaters.models.simple_post side_effect N/A N/A MockResponse status_code 400 reason Ugly mock_post N/A N/A N/A N/A self assertRaises RequestConnectionError N/A N/A N/A simple_post_with_cached_timeout abc http://google.com N/A N/A N/A self assertEqual N/A mock_post call_count 1 N/A N/A N/A self assertRaises RequestConnectionError N/A N/A N/A simple_post_with_cached_timeout abc http://google.com N/A N/A N/A self assertEqual N/A mock_post call_count 1 N/A test_bust_cache_new_url N/A N/A self N/A N/A N/A 
        Ensure that the cache is busted when the URL changes
         N/A N/A patch corehq.apps.repeaters.models.simple_post side_effect N/A ConnectionError Timeout! mock_post N/A N/A N/A N/A self assertRaises RequestConnectionError N/A N/A N/A simple_post_with_cached_timeout abc http://google.com N/A N/A N/A self assertEqual N/A mock_post call_count 1 N/A N/A N/A self assertRaises RequestConnectionError N/A N/A N/A simple_post_with_cached_timeout abc http://different.com N/A N/A N/A self assertEqual N/A mock_post call_count 2 N/A test_force_send N/A N/A self N/A N/A N/A N/A patch corehq.apps.repeaters.models.simple_post side_effect N/A ConnectionError Timeout! mock_post N/A N/A N/A N/A self assertRaises RequestConnectionError N/A N/A N/A simple_post_with_cached_timeout abc http://google.com N/A N/A N/A self assertEqual N/A mock_post call_count 1 N/A N/A N/A self assertRaises RequestConnectionError N/A N/A N/A simple_post_with_cached_timeout abc http://google.com force_send True N/A N/A N/A self assertEqual N/A mock_post call_count 2 N/A N/A