Merge "Make some tests more like Aodh tests"
This commit is contained in:
commit
1670d00a4b
@ -34,11 +34,11 @@ class TestAPIACL(v2.FunctionalTest):
|
|||||||
return webtest.TestApp(app.load_app(conf=self.CONF))
|
return webtest.TestApp(app.load_app(conf=self.CONF))
|
||||||
|
|
||||||
def test_non_authenticated(self):
|
def test_non_authenticated(self):
|
||||||
response = self.get_json('/meters', expect_errors=True)
|
response = self.get_json('/alarms', expect_errors=True)
|
||||||
self.assertEqual(401, response.status_int)
|
self.assertEqual(401, response.status_int)
|
||||||
|
|
||||||
def test_authenticated_wrong_role(self):
|
def test_authenticated_wrong_role(self):
|
||||||
response = self.get_json('/meters',
|
response = self.get_json('/alarms',
|
||||||
expect_errors=True,
|
expect_errors=True,
|
||||||
headers={
|
headers={
|
||||||
"X-Roles": "Member",
|
"X-Roles": "Member",
|
||||||
|
@ -35,13 +35,6 @@ class FakeComplexQuery(query.ValidatedComplexQuery):
|
|||||||
metadata_allowed=metadata)
|
metadata_allowed=metadata)
|
||||||
|
|
||||||
|
|
||||||
sample_name_mapping = {"resource": "resource_id",
|
|
||||||
"meter": "counter_name",
|
|
||||||
"type": "counter_type",
|
|
||||||
"unit": "counter_unit",
|
|
||||||
"volume": "counter_volume"}
|
|
||||||
|
|
||||||
|
|
||||||
class TestComplexQuery(base.BaseTestCase):
|
class TestComplexQuery(base.BaseTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestComplexQuery, self).setUp()
|
super(TestComplexQuery, self).setUp()
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
"""Tests complex queries for samples
|
"""Tests complex queries for alarms
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
@ -165,8 +165,8 @@ class TestQueryAlarmsController(tests_api.FunctionalTest):
|
|||||||
'{"=": {"project": "project-id2"}}'})
|
'{"=": {"project": "project-id2"}}'})
|
||||||
|
|
||||||
self.assertEqual(6, len(data.json))
|
self.assertEqual(6, len(data.json))
|
||||||
for sample_item in data.json:
|
for alarm_item in data.json:
|
||||||
self.assertIn(sample_item['project_id'], set(["project-id2"]))
|
self.assertIn(alarm_item['project_id'], set(["project-id2"]))
|
||||||
|
|
||||||
def test_query_with_field_user_in_orderby(self):
|
def test_query_with_field_user_in_orderby(self):
|
||||||
data = self.post_json(self.alarm_url,
|
data = self.post_json(self.alarm_url,
|
||||||
|
Loading…
Reference in New Issue
Block a user