class_docstr: Tests for shared/rule_table.py
docstr: Rule Table - Toggle Staging, Already Staged (Update Window)
docstr_tok: ["Rule","Table","-","Toggle","Staging",",","Already","Staged","(","Update","Window",")"]
code: def test_toggle_staged_state_update(self, log_mock):
      """Rule Table - Toggle Staging, Already Staged (Update Window)"""
      rule_name = "staged_rule"
      staged = True
      self.rule_table._table.put_item(
          Item={
              "RuleName": rule_name,
              "Staged": staged,
              "StagedAt": "2018-01-01T01:01:01.000Z",
          }
      )
  
      # Make sure the item that was added is staged
      orig_item = self.rule_table._table.get_item(
          Key={"RuleName": rule_name}
      )
      assert_equal(orig_item["Item"]["Staged"], staged)
  
      # Try to toggle the state of the already staged rule to staged
      # This should implicitly update the staging window
      self.rule_table.toggle_staged_state(rule_name, staged)
      log_mock.assert_called_with(
          "Rule '%s' is already staged and will have its staging window updated",
          rule_name,
      )
  
      # Make sure the item is still staged
      new_item = self.rule_table._table.get_item(
          Key={"RuleName": rule_name}
      )
      assert_equal(new_item["Item"]["Staged"], True)
      assert_not_equal(
          orig_item["Item"]["StagedAt"], new_item["Item"]["StagedAt"]
      )
  
imports: from datetime import datetime
  import os
  from io import StringIO
  from botocore.exceptions import ClientError
  from mock import Mock, patch
  from moto import mock_dynamodb2
  from nose.tools import assert_equal, assert_not_equal, assert_raises
  from streamalert.shared import rule, rule_table
  from tests.unit.helpers.aws_mocks import setup_mock_rules_table
label_desc: Use image node_id 24 for calling the TestRuleTable obj's underlying member method code with example usage: obj.test_toggle_staged_state_update(log_mock) without return types