Example #1
0
 def test_warning_when_deprecated_user_based_rule_used(self, mock_warning):
     policy._warning_for_deprecated_user_based_rules(
         [("os_compute_api:servers:index",
             "project_id:%(project_id)s or user_id:%(user_id)s")])
     mock_warning.assert_called_once_with(
         u"The user_id attribute isn't supported in the rule "
          "'%s'. All the user_id based policy enforcement will be removed "
          "in the future.", "os_compute_api:servers:index")
Example #2
0
 def test_warning_when_deprecated_user_based_rule_used(self, mock_warning):
     policy._warning_for_deprecated_user_based_rules(
         [("os_compute_api:servers:index",
             "project_id:%(project_id)s or user_id:%(user_id)s")])
     mock_warning.assert_called_once_with(
         u"The user_id attribute isn't supported in the rule "
          "'%s'. All the user_id based policy enforcement will be removed "
          "in the future.", "os_compute_api:servers:index")
Example #3
0
 def test_no_warning_for_no_user_based_rule(self, mock_warning):
     policy._warning_for_deprecated_user_based_rules([
         ("os_compute_api:servers:index", "project_id:%(project_id)s")
     ])
     mock_warning.assert_not_called()
Example #4
0
 def test_no_warning_for_user_based_resource(self, mock_warning):
     policy._warning_for_deprecated_user_based_rules([
         ("os_compute_api:os-keypairs:index", "user_id:%(user_id)s")
     ])
     mock_warning.assert_not_called()
Example #5
0
 def test_no_warning_for_no_user_based_rule(self, mock_warning):
     policy._warning_for_deprecated_user_based_rules(
         [("os_compute_api:servers:index",
             "project_id:%(project_id)s")])
     mock_warning.assert_not_called()
Example #6
0
 def test_no_warning_for_user_based_resource(self, mock_warning):
     policy._warning_for_deprecated_user_based_rules(
         [("os_compute_api:os-keypairs:index",
             "user_id:%(user_id)s")])
     mock_warning.assert_not_called()