Specify transform=repr in assertQuerysetEqual()
Previously "repr" was automatically applied to "qs" argument of assertQuerysetEqual() and most horizon unittest behaviors assume it. It was deprecated in Django 3.2 and removed in Django 4.1. We need to specify transform=repr explicitly to use the existing behavior. [1] https://docs.djangoproject.com/en/3.2/topics/testing/tools/#django.test.TransactionTestCase.assertQuerysetEqual Closes-Bug: #2038474 Change-Id: Ie7c7e9a1efc492889639e25509c8e614268c1d26
This commit is contained in:
parent
40e416b8fc
commit
8770753fcc
@ -432,7 +432,8 @@ class DataTableTests(test.TestCase):
|
|||||||
'<Column: value>',
|
'<Column: value>',
|
||||||
'<Column: optional>',
|
'<Column: optional>',
|
||||||
'<Column: status>',
|
'<Column: status>',
|
||||||
'<MyColumn: actions>'])
|
'<MyColumn: actions>'],
|
||||||
|
transform=repr)
|
||||||
# Actions (these also test ordering)
|
# Actions (these also test ordering)
|
||||||
self.assertQuerysetEqual(list(self.table.base_actions.values()),
|
self.assertQuerysetEqual(list(self.table.base_actions.values()),
|
||||||
['<MyBatchAction: batch>',
|
['<MyBatchAction: batch>',
|
||||||
@ -440,18 +441,21 @@ class DataTableTests(test.TestCase):
|
|||||||
'<MyAction: delete>',
|
'<MyAction: delete>',
|
||||||
'<MyFilterAction: filter>',
|
'<MyFilterAction: filter>',
|
||||||
'<MyLinkAction: login>',
|
'<MyLinkAction: login>',
|
||||||
'<MyToggleAction: toggle>'])
|
'<MyToggleAction: toggle>'],
|
||||||
|
transform=repr)
|
||||||
self.assertQuerysetEqual(self.table.get_table_actions(),
|
self.assertQuerysetEqual(self.table.get_table_actions(),
|
||||||
['<MyFilterAction: filter>',
|
['<MyFilterAction: filter>',
|
||||||
'<MyAction: delete>',
|
'<MyAction: delete>',
|
||||||
'<MyBatchAction: batch>',
|
'<MyBatchAction: batch>',
|
||||||
'<MyBatchActionWithHelpText: batch_help>'])
|
'<MyBatchActionWithHelpText: batch_help>'],
|
||||||
|
transform=repr)
|
||||||
self.assertQuerysetEqual(self.table.get_row_actions(TEST_DATA[0]),
|
self.assertQuerysetEqual(self.table.get_row_actions(TEST_DATA[0]),
|
||||||
['<MyAction: delete>',
|
['<MyAction: delete>',
|
||||||
'<MyLinkAction: login>',
|
'<MyLinkAction: login>',
|
||||||
'<MyBatchAction: batch>',
|
'<MyBatchAction: batch>',
|
||||||
'<MyToggleAction: toggle>',
|
'<MyToggleAction: toggle>',
|
||||||
'<MyBatchActionWithHelpText: batch_help>'])
|
'<MyBatchActionWithHelpText: batch_help>'],
|
||||||
|
transform=repr)
|
||||||
# Auto-generated columns
|
# Auto-generated columns
|
||||||
multi_select = self.table.columns['multi_select']
|
multi_select = self.table.columns['multi_select']
|
||||||
self.assertEqual("multi_select", multi_select.auto)
|
self.assertEqual("multi_select", multi_select.auto)
|
||||||
@ -472,7 +476,9 @@ class DataTableTests(test.TestCase):
|
|||||||
self.assertEqual(TEST_DATA, self.table.data)
|
self.assertEqual(TEST_DATA, self.table.data)
|
||||||
# The column "restricted" is not rendered because of policy
|
# The column "restricted" is not rendered because of policy
|
||||||
expected_columns = ['<Column: name>']
|
expected_columns = ['<Column: name>']
|
||||||
self.assertQuerysetEqual(self.table.get_columns(), expected_columns)
|
self.assertQuerysetEqual(self.table.get_columns(),
|
||||||
|
expected_columns,
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
@override_settings(POLICY_CHECK_FUNCTION=lambda *args: True)
|
@override_settings(POLICY_CHECK_FUNCTION=lambda *args: True)
|
||||||
def test_table_column_policy_allowed(self):
|
def test_table_column_policy_allowed(self):
|
||||||
@ -480,7 +486,8 @@ class DataTableTests(test.TestCase):
|
|||||||
self.assertEqual(TEST_DATA, self.table.data)
|
self.assertEqual(TEST_DATA, self.table.data)
|
||||||
# Policy check returns True so the column "restricted" is rendered
|
# Policy check returns True so the column "restricted" is rendered
|
||||||
expected_columns = ['<Column: name>', '<Column: restricted>']
|
expected_columns = ['<Column: name>', '<Column: restricted>']
|
||||||
self.assertQuerysetEqual(self.table.get_columns(), expected_columns)
|
self.assertQuerysetEqual(self.table.get_columns(), expected_columns,
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
def test_table_force_no_multiselect(self):
|
def test_table_force_no_multiselect(self):
|
||||||
class TempTable(MyTable):
|
class TempTable(MyTable):
|
||||||
@ -492,7 +499,8 @@ class DataTableTests(test.TestCase):
|
|||||||
self.table = TempTable(self.request, TEST_DATA)
|
self.table = TempTable(self.request, TEST_DATA)
|
||||||
self.assertQuerysetEqual(self.table.get_columns(),
|
self.assertQuerysetEqual(self.table.get_columns(),
|
||||||
['<Column: id>',
|
['<Column: id>',
|
||||||
'<Column: actions>'])
|
'<Column: actions>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
def test_table_force_no_actions_column(self):
|
def test_table_force_no_actions_column(self):
|
||||||
class TempTable(MyTable):
|
class TempTable(MyTable):
|
||||||
@ -504,7 +512,8 @@ class DataTableTests(test.TestCase):
|
|||||||
self.table = TempTable(self.request, TEST_DATA)
|
self.table = TempTable(self.request, TEST_DATA)
|
||||||
self.assertQuerysetEqual(self.table.get_columns(),
|
self.assertQuerysetEqual(self.table.get_columns(),
|
||||||
['<Column: multi_select>',
|
['<Column: multi_select>',
|
||||||
'<Column: id>'])
|
'<Column: id>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
def test_table_natural_no_inline_editing(self):
|
def test_table_natural_no_inline_editing(self):
|
||||||
class TempTable(MyTable):
|
class TempTable(MyTable):
|
||||||
@ -530,7 +539,8 @@ class DataTableTests(test.TestCase):
|
|||||||
self.table = TempTable(self.request, TEST_DATA)
|
self.table = TempTable(self.request, TEST_DATA)
|
||||||
self.assertQuerysetEqual(self.table.get_columns(),
|
self.assertQuerysetEqual(self.table.get_columns(),
|
||||||
['<Column: multi_select>',
|
['<Column: multi_select>',
|
||||||
'<Column: id>'])
|
'<Column: id>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
def test_table_natural_no_multiselect(self):
|
def test_table_natural_no_multiselect(self):
|
||||||
class TempTable(MyTable):
|
class TempTable(MyTable):
|
||||||
@ -540,7 +550,8 @@ class DataTableTests(test.TestCase):
|
|||||||
self.table = TempTable(self.request, TEST_DATA)
|
self.table = TempTable(self.request, TEST_DATA)
|
||||||
self.assertQuerysetEqual(self.table.get_columns(),
|
self.assertQuerysetEqual(self.table.get_columns(),
|
||||||
['<Column: id>',
|
['<Column: id>',
|
||||||
'<Column: actions>'])
|
'<Column: actions>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
def test_table_column_inheritance(self):
|
def test_table_column_inheritance(self):
|
||||||
class TempTable(MyTable):
|
class TempTable(MyTable):
|
||||||
@ -561,25 +572,30 @@ class DataTableTests(test.TestCase):
|
|||||||
'<Column: optional>',
|
'<Column: optional>',
|
||||||
'<Column: excluded>',
|
'<Column: excluded>',
|
||||||
'<Column: extra>',
|
'<Column: extra>',
|
||||||
'<Column: actions>'])
|
'<Column: actions>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
def test_table_construction(self):
|
def test_table_construction(self):
|
||||||
self.table = MyTable(self.request, TEST_DATA)
|
self.table = MyTable(self.request, TEST_DATA)
|
||||||
# Verify we retrieve the right columns for headers
|
# Verify we retrieve the right columns for headers
|
||||||
columns = self.table.get_columns()
|
columns = self.table.get_columns()
|
||||||
self.assertQuerysetEqual(columns, ['<MyColumn: multi_select>',
|
self.assertQuerysetEqual(columns,
|
||||||
|
['<MyColumn: multi_select>',
|
||||||
'<Column: id>',
|
'<Column: id>',
|
||||||
'<Column: name>',
|
'<Column: name>',
|
||||||
'<Column: value>',
|
'<Column: value>',
|
||||||
'<Column: optional>',
|
'<Column: optional>',
|
||||||
'<Column: status>',
|
'<Column: status>',
|
||||||
'<MyColumn: actions>'])
|
'<MyColumn: actions>'],
|
||||||
|
transform=repr)
|
||||||
# Verify we retrieve the right rows from our data
|
# Verify we retrieve the right rows from our data
|
||||||
rows = self.table.get_rows()
|
rows = self.table.get_rows()
|
||||||
self.assertQuerysetEqual(rows, ['<MyRow: my_table__row__1>',
|
self.assertQuerysetEqual(rows,
|
||||||
|
['<MyRow: my_table__row__1>',
|
||||||
'<MyRow: my_table__row__2>',
|
'<MyRow: my_table__row__2>',
|
||||||
'<MyRow: my_table__row__3>',
|
'<MyRow: my_table__row__3>',
|
||||||
'<MyRow: my_table__row__4>'])
|
'<MyRow: my_table__row__4>'],
|
||||||
|
transform=repr)
|
||||||
# Verify each row contains the right cells
|
# Verify each row contains the right cells
|
||||||
self.assertQuerysetEqual(rows[0].get_cells(),
|
self.assertQuerysetEqual(rows[0].get_cells(),
|
||||||
['<Cell: multi_select, my_table__row__1>',
|
['<Cell: multi_select, my_table__row__1>',
|
||||||
@ -588,7 +604,8 @@ class DataTableTests(test.TestCase):
|
|||||||
'<Cell: value, my_table__row__1>',
|
'<Cell: value, my_table__row__1>',
|
||||||
'<Cell: optional, my_table__row__1>',
|
'<Cell: optional, my_table__row__1>',
|
||||||
'<Cell: status, my_table__row__1>',
|
'<Cell: status, my_table__row__1>',
|
||||||
'<Cell: actions, my_table__row__1>'])
|
'<Cell: actions, my_table__row__1>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
def test_table_column(self):
|
def test_table_column(self):
|
||||||
self.table = MyTable(self.request, TEST_DATA)
|
self.table = MyTable(self.request, TEST_DATA)
|
||||||
@ -814,7 +831,8 @@ class DataTableTests(test.TestCase):
|
|||||||
req = self.factory.post('/my_url/', {action_string: '2'})
|
req = self.factory.post('/my_url/', {action_string: '2'})
|
||||||
self.table = TempTable(req, TEST_DATA)
|
self.table = TempTable(req, TEST_DATA)
|
||||||
self.assertQuerysetEqual(self.table.get_table_actions(),
|
self.assertQuerysetEqual(self.table.get_table_actions(),
|
||||||
['<NameFilterAction: filter>'])
|
['<NameFilterAction: filter>'],
|
||||||
|
transform=repr)
|
||||||
handled = self.table.maybe_handle()
|
handled = self.table.maybe_handle()
|
||||||
self.assertIsNone(handled)
|
self.assertIsNone(handled)
|
||||||
self.assertQuerysetEqual(self.table.filtered_data,
|
self.assertQuerysetEqual(self.table.filtered_data,
|
||||||
@ -985,7 +1003,8 @@ class DataTableTests(test.TestCase):
|
|||||||
['<MyFilterAction: filter>',
|
['<MyFilterAction: filter>',
|
||||||
'<MyAction: delete>',
|
'<MyAction: delete>',
|
||||||
'<MyBatchAction: batch>',
|
'<MyBatchAction: batch>',
|
||||||
'<MyBatchActionWithHelpText: batch_help>'])
|
'<MyBatchActionWithHelpText: batch_help>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
# Zero objects in table
|
# Zero objects in table
|
||||||
# BatchAction not available
|
# BatchAction not available
|
||||||
@ -993,7 +1012,8 @@ class DataTableTests(test.TestCase):
|
|||||||
self.table = MyTable(req, None)
|
self.table = MyTable(req, None)
|
||||||
self.assertQuerysetEqual(self.table.get_table_actions(),
|
self.assertQuerysetEqual(self.table.get_table_actions(),
|
||||||
['<MyFilterAction: filter>',
|
['<MyFilterAction: filter>',
|
||||||
'<MyAction: delete>'])
|
'<MyAction: delete>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
# Filtering
|
# Filtering
|
||||||
action_string = "my_table__filter__q"
|
action_string = "my_table__filter__q"
|
||||||
@ -1209,7 +1229,8 @@ class DataTableTests(test.TestCase):
|
|||||||
'<Cell: name, my_table__row__1>',
|
'<Cell: name, my_table__row__1>',
|
||||||
'<Cell: value, my_table__row__1>',
|
'<Cell: value, my_table__row__1>',
|
||||||
'<Cell: status, my_table__row__1>',
|
'<Cell: status, my_table__row__1>',
|
||||||
])
|
],
|
||||||
|
transform=repr)
|
||||||
# can_be_selected = False
|
# can_be_selected = False
|
||||||
self.assertEqual("", row.get_cells()[0].data)
|
self.assertEqual("", row.get_cells()[0].data)
|
||||||
# can_be_selected = True
|
# can_be_selected = True
|
||||||
|
@ -142,10 +142,12 @@ class TabTests(test.TestCase):
|
|||||||
# "tab_disallowed" should NOT be in this list.
|
# "tab_disallowed" should NOT be in this list.
|
||||||
# "tab_with_policy" should be present, since our policy check
|
# "tab_with_policy" should be present, since our policy check
|
||||||
# always passes
|
# always passes
|
||||||
self.assertQuerysetEqual(tabs, ['<TabOne: tab_one>',
|
self.assertQuerysetEqual(tabs,
|
||||||
|
['<TabOne: tab_one>',
|
||||||
'<TabDelayed: tab_delayed>',
|
'<TabDelayed: tab_delayed>',
|
||||||
'<TabDisabled: tab_disabled>',
|
'<TabDisabled: tab_disabled>',
|
||||||
'<TabWithPolicy: tab_with_policy>'])
|
'<TabWithPolicy: tab_with_policy>'],
|
||||||
|
transform=repr)
|
||||||
# Test get_id
|
# Test get_id
|
||||||
self.assertEqual("tab_group", tg.get_id())
|
self.assertEqual("tab_group", tg.get_id())
|
||||||
# get_default_classes
|
# get_default_classes
|
||||||
@ -169,9 +171,11 @@ class TabTests(test.TestCase):
|
|||||||
# "tab_disallowed" should NOT be in this list, it's not allowed
|
# "tab_disallowed" should NOT be in this list, it's not allowed
|
||||||
# "tab_with_policy" should also not be present as its
|
# "tab_with_policy" should also not be present as its
|
||||||
# policy check failed
|
# policy check failed
|
||||||
self.assertQuerysetEqual(tabs, ['<TabOne: tab_one>',
|
self.assertQuerysetEqual(tabs,
|
||||||
|
['<TabOne: tab_one>',
|
||||||
'<TabDelayed: tab_delayed>',
|
'<TabDelayed: tab_delayed>',
|
||||||
'<TabDisabled: tab_disabled>'])
|
'<TabDisabled: tab_disabled>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
@test.update_settings(
|
@test.update_settings(
|
||||||
HORIZON_CONFIG={'extra_tabs': {
|
HORIZON_CONFIG={'extra_tabs': {
|
||||||
@ -187,9 +191,11 @@ class TabTests(test.TestCase):
|
|||||||
tabs = tg.get_tabs()
|
tabs = tg.get_tabs()
|
||||||
# "tab_disallowed" should NOT be in this list.
|
# "tab_disallowed" should NOT be in this list.
|
||||||
# Other tabs must be ordered in the priorities in HORIZON_CONFIG.
|
# Other tabs must be ordered in the priorities in HORIZON_CONFIG.
|
||||||
self.assertQuerysetEqual(tabs, ['<TabOne: tab_one>',
|
self.assertQuerysetEqual(tabs,
|
||||||
|
['<TabOne: tab_one>',
|
||||||
'<TabDisabled: tab_disabled>',
|
'<TabDisabled: tab_disabled>',
|
||||||
'<TabDelayed: tab_delayed>'])
|
'<TabDelayed: tab_delayed>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
def test_tab_group_active_tab(self):
|
def test_tab_group_active_tab(self):
|
||||||
tg = Group(self.request)
|
tg = Group(self.request)
|
||||||
|
@ -154,7 +154,8 @@ class HorizonTests(BaseHorizonTests):
|
|||||||
self.assertQuerysetEqual(horizon.get_dashboards(),
|
self.assertQuerysetEqual(horizon.get_dashboards(),
|
||||||
['<Dashboard: cats>',
|
['<Dashboard: cats>',
|
||||||
'<Dashboard: dogs>',
|
'<Dashboard: dogs>',
|
||||||
'<Dashboard: mydash>'])
|
'<Dashboard: mydash>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
# Removal
|
# Removal
|
||||||
self.assertEqual(3, len(base.Horizon._registry))
|
self.assertEqual(3, len(base.Horizon._registry))
|
||||||
@ -177,7 +178,8 @@ class HorizonTests(BaseHorizonTests):
|
|||||||
['<Dashboard: cats>',
|
['<Dashboard: cats>',
|
||||||
'<Dashboard: dogs>',
|
'<Dashboard: dogs>',
|
||||||
'<Dashboard: mydash>',
|
'<Dashboard: mydash>',
|
||||||
'<Dashboard: mydash2>'])
|
'<Dashboard: mydash2>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
# Removal
|
# Removal
|
||||||
self.assertEqual(4, len(base.Horizon._registry))
|
self.assertEqual(4, len(base.Horizon._registry))
|
||||||
@ -203,7 +205,8 @@ class HorizonTests(BaseHorizonTests):
|
|||||||
self.assertEqual(base.Horizon, cats._registered_with)
|
self.assertEqual(base.Horizon, cats._registered_with)
|
||||||
self.assertQuerysetEqual(cats.get_panels(),
|
self.assertQuerysetEqual(cats.get_panels(),
|
||||||
['<Panel: kittens>',
|
['<Panel: kittens>',
|
||||||
'<Panel: tigers>'])
|
'<Panel: tigers>'],
|
||||||
|
transform=repr)
|
||||||
self.assertEqual("/cats/", cats.get_absolute_url())
|
self.assertEqual("/cats/", cats.get_absolute_url())
|
||||||
self.assertEqual("Cats", cats.name)
|
self.assertEqual("Cats", cats.name)
|
||||||
|
|
||||||
@ -211,11 +214,13 @@ class HorizonTests(BaseHorizonTests):
|
|||||||
# as a panel group.
|
# as a panel group.
|
||||||
cats.register(MyPanel)
|
cats.register(MyPanel)
|
||||||
self.assertQuerysetEqual(list(cats.get_panel_groups()['other']),
|
self.assertQuerysetEqual(list(cats.get_panel_groups()['other']),
|
||||||
['<Panel: myslug>'])
|
['<Panel: myslug>'],
|
||||||
|
transform=repr)
|
||||||
# Test that panels defined as a tuple still return a PanelGroup
|
# Test that panels defined as a tuple still return a PanelGroup
|
||||||
dogs = horizon.get_dashboard("dogs")
|
dogs = horizon.get_dashboard("dogs")
|
||||||
self.assertQuerysetEqual(list(dogs.get_panel_groups().values()),
|
self.assertQuerysetEqual(list(dogs.get_panel_groups().values()),
|
||||||
['<PanelGroup: default>'])
|
['<PanelGroup: default>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
# Test registering a module with a dashboard that defines panels
|
# Test registering a module with a dashboard that defines panels
|
||||||
# as a tuple.
|
# as a tuple.
|
||||||
@ -223,7 +228,8 @@ class HorizonTests(BaseHorizonTests):
|
|||||||
dogs.register(MyPanel)
|
dogs.register(MyPanel)
|
||||||
self.assertQuerysetEqual(dogs.get_panels(),
|
self.assertQuerysetEqual(dogs.get_panels(),
|
||||||
['<Panel: puppies>',
|
['<Panel: puppies>',
|
||||||
'<Panel: myslug>'])
|
'<Panel: myslug>'],
|
||||||
|
transform=repr)
|
||||||
cats.unregister(MyPanel)
|
cats.unregister(MyPanel)
|
||||||
dogs.unregister(MyPanel)
|
dogs.unregister(MyPanel)
|
||||||
|
|
||||||
@ -424,7 +430,8 @@ class CustomPanelTests(BaseHorizonTests):
|
|||||||
cats = horizon.get_dashboard("cats")
|
cats = horizon.get_dashboard("cats")
|
||||||
self.assertEqual("WildCats", cats.name)
|
self.assertEqual("WildCats", cats.name)
|
||||||
self.assertQuerysetEqual(cats.get_panels(),
|
self.assertQuerysetEqual(cats.get_panels(),
|
||||||
['<Panel: kittens>'])
|
['<Panel: kittens>'],
|
||||||
|
transform=repr)
|
||||||
with self.assertRaises(base.NotRegistered):
|
with self.assertRaises(base.NotRegistered):
|
||||||
horizon.get_dashboard("dogs")
|
horizon.get_dashboard("dogs")
|
||||||
|
|
||||||
@ -545,12 +552,14 @@ class RbacHorizonTests(test.TestCase):
|
|||||||
cats = horizon.get_dashboard("cats")
|
cats = horizon.get_dashboard("cats")
|
||||||
self.assertEqual(cats._registered_with, base.Horizon)
|
self.assertEqual(cats._registered_with, base.Horizon)
|
||||||
self.assertQuerysetEqual(cats.get_panels(),
|
self.assertQuerysetEqual(cats.get_panels(),
|
||||||
['<Panel: rbac_panel_no>'])
|
['<Panel: rbac_panel_no>'],
|
||||||
|
transform=repr)
|
||||||
self.assertFalse(cats.can_access(context))
|
self.assertFalse(cats.can_access(context))
|
||||||
|
|
||||||
dogs = horizon.get_dashboard("dogs")
|
dogs = horizon.get_dashboard("dogs")
|
||||||
self.assertEqual(dogs._registered_with, base.Horizon)
|
self.assertEqual(dogs._registered_with, base.Horizon)
|
||||||
self.assertQuerysetEqual(dogs.get_panels(),
|
self.assertQuerysetEqual(dogs.get_panels(),
|
||||||
['<Panel: rbac_panel_yes>'])
|
['<Panel: rbac_panel_yes>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
self.assertTrue(dogs.can_access(context))
|
self.assertTrue(dogs.can_access(context))
|
||||||
|
@ -203,7 +203,8 @@ class WorkflowsTests(test.TestCase):
|
|||||||
self.assertQuerysetEqual(flow.steps,
|
self.assertQuerysetEqual(flow.steps,
|
||||||
['<StepOne: action_one>',
|
['<StepOne: action_one>',
|
||||||
'<StepThree: action_three>',
|
'<StepThree: action_three>',
|
||||||
'<StepTwo: action_two>'])
|
'<StepTwo: action_two>'],
|
||||||
|
transform=repr)
|
||||||
self.assertEqual(set(['project_id']), flow.depends_on)
|
self.assertEqual(set(['project_id']), flow.depends_on)
|
||||||
|
|
||||||
@test.update_settings(HORIZON_CONFIG={'extra_steps': {
|
@test.update_settings(HORIZON_CONFIG={'extra_steps': {
|
||||||
@ -221,8 +222,8 @@ class WorkflowsTests(test.TestCase):
|
|||||||
['<StepOne: action_one>',
|
['<StepOne: action_one>',
|
||||||
'<StepThree: action_three>',
|
'<StepThree: action_three>',
|
||||||
'<StepTwo: action_two>',
|
'<StepTwo: action_two>',
|
||||||
'<StepFour: action_four>',
|
'<StepFour: action_four>'],
|
||||||
])
|
transform=repr)
|
||||||
|
|
||||||
def test_step_construction(self):
|
def test_step_construction(self):
|
||||||
step_one = StepOne(WorkflowForTesting(self.request))
|
step_one = StepOne(WorkflowForTesting(self.request))
|
||||||
@ -327,14 +328,16 @@ class WorkflowsTests(test.TestCase):
|
|||||||
flow = WorkflowForTesting(req)
|
flow = WorkflowForTesting(req)
|
||||||
self.assertQuerysetEqual(flow.steps,
|
self.assertQuerysetEqual(flow.steps,
|
||||||
['<StepOne: action_one>',
|
['<StepOne: action_one>',
|
||||||
'<StepTwo: action_two>'])
|
'<StepTwo: action_two>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
WorkflowForTesting.register(StepThree)
|
WorkflowForTesting.register(StepThree)
|
||||||
flow = WorkflowForTesting(req)
|
flow = WorkflowForTesting(req)
|
||||||
self.assertQuerysetEqual(flow.steps,
|
self.assertQuerysetEqual(flow.steps,
|
||||||
['<StepOne: action_one>',
|
['<StepOne: action_one>',
|
||||||
'<StepThree: action_three>',
|
'<StepThree: action_three>',
|
||||||
'<StepTwo: action_two>'])
|
'<StepTwo: action_two>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
def test_workflow_unregister_unexisting_workflow(self):
|
def test_workflow_unregister_unexisting_workflow(self):
|
||||||
with self.assertRaises(base.NotRegistered):
|
with self.assertRaises(base.NotRegistered):
|
||||||
@ -360,7 +363,8 @@ class WorkflowsTests(test.TestCase):
|
|||||||
("horizon.test",))
|
("horizon.test",))
|
||||||
self.assertQuerysetEqual(flow.steps,
|
self.assertQuerysetEqual(flow.steps,
|
||||||
['<StepOne: action_one>',
|
['<StepOne: action_one>',
|
||||||
'<StepTwo: action_two>'])
|
'<StepTwo: action_two>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
self.set_permissions(['test'])
|
self.set_permissions(['test'])
|
||||||
self.request.user = self.user
|
self.request.user = self.user
|
||||||
@ -368,7 +372,8 @@ class WorkflowsTests(test.TestCase):
|
|||||||
self.assertQuerysetEqual(flow.steps,
|
self.assertQuerysetEqual(flow.steps,
|
||||||
['<StepOne: action_one>',
|
['<StepOne: action_one>',
|
||||||
'<AdminStep: admin_action>',
|
'<AdminStep: admin_action>',
|
||||||
'<StepTwo: action_two>'])
|
'<StepTwo: action_two>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
def test_has_allowed(self):
|
def test_has_allowed(self):
|
||||||
WorkflowForTesting.register(DisabledStep)
|
WorkflowForTesting.register(DisabledStep)
|
||||||
@ -377,7 +382,8 @@ class WorkflowsTests(test.TestCase):
|
|||||||
# even though DisabledStep is registered.
|
# even though DisabledStep is registered.
|
||||||
self.assertQuerysetEqual(flow.steps,
|
self.assertQuerysetEqual(flow.steps,
|
||||||
['<StepOne: action_one>',
|
['<StepOne: action_one>',
|
||||||
'<StepTwo: action_two>'])
|
'<StepTwo: action_two>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
def test_step_is_hidden_on_policy(self):
|
def test_step_is_hidden_on_policy(self):
|
||||||
self.policy_patcher.stop()
|
self.policy_patcher.stop()
|
||||||
|
@ -52,7 +52,8 @@ class CreateAggregateWorkflowTests(BaseAggregateWorkflowTests):
|
|||||||
self.assertQuerysetEqual(
|
self.assertQuerysetEqual(
|
||||||
workflow.steps,
|
workflow.steps,
|
||||||
['<SetAggregateInfoStep: set_aggregate_info>',
|
['<SetAggregateInfoStep: set_aggregate_info>',
|
||||||
'<AddHostsToAggregateStep: add_host_to_aggregate>'])
|
'<AddHostsToAggregateStep: add_host_to_aggregate>'],
|
||||||
|
transform=repr)
|
||||||
self.mock_service_list.assert_called_once_with(
|
self.mock_service_list.assert_called_once_with(
|
||||||
test.IsHttpRequest(),
|
test.IsHttpRequest(),
|
||||||
binary='nova-compute')
|
binary='nova-compute')
|
||||||
|
@ -101,6 +101,7 @@ class ServicesViewTests(test.BaseAdminViewTests):
|
|||||||
quotas_tab = res.context['tab_group'].get_tab(slug)
|
quotas_tab = res.context['tab_group'].get_tab(slug)
|
||||||
self.assertQuerysetEqual(quotas_tab._tables[slug].data,
|
self.assertQuerysetEqual(quotas_tab._tables[slug].data,
|
||||||
expected_data,
|
expected_data,
|
||||||
|
transform=repr,
|
||||||
ordered=False)
|
ordered=False)
|
||||||
|
|
||||||
|
|
||||||
|
@ -254,7 +254,8 @@ class CreateFlavorWorkflowTests(BaseFlavorWorkflowTests):
|
|||||||
self.assertQuerysetEqual(
|
self.assertQuerysetEqual(
|
||||||
workflow.steps,
|
workflow.steps,
|
||||||
['<CreateFlavorInfo: createflavorinfoaction>',
|
['<CreateFlavorInfo: createflavorinfoaction>',
|
||||||
'<CreateFlavorAccess: flavor_access>'])
|
'<CreateFlavorAccess: flavor_access>'],
|
||||||
|
transform=repr)
|
||||||
self.mock_tenant_list.assert_called_once_with(test.IsHttpRequest())
|
self.mock_tenant_list.assert_called_once_with(test.IsHttpRequest())
|
||||||
|
|
||||||
@test.create_mocks({api.keystone: ('tenant_list',),
|
@test.create_mocks({api.keystone: ('tenant_list',),
|
||||||
@ -471,7 +472,8 @@ class UpdateFlavorWorkflowTests(BaseFlavorWorkflowTests):
|
|||||||
|
|
||||||
self.assertQuerysetEqual(
|
self.assertQuerysetEqual(
|
||||||
workflow.steps,
|
workflow.steps,
|
||||||
['<UpdateFlavorAccess: flavor_access>'])
|
['<UpdateFlavorAccess: flavor_access>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
step = workflow.get_step("flavor_access")
|
step = workflow.get_step("flavor_access")
|
||||||
field_name = step.get_member_field_name('member')
|
field_name = step.get_member_field_name('member')
|
||||||
|
@ -76,7 +76,8 @@ class SystemInfoViewTests(test.BaseAdminViewTests):
|
|||||||
network_agents_tab = res.context['tab_group'].get_tab('network_agents')
|
network_agents_tab = res.context['tab_group'].get_tab('network_agents')
|
||||||
self.assertQuerysetEqual(
|
self.assertQuerysetEqual(
|
||||||
network_agents_tab._tables['network_agents'].data,
|
network_agents_tab._tables['network_agents'].data,
|
||||||
[agent.__repr__() for agent in self.agents.list()]
|
[agent.__repr__() for agent in self.agents.list()],
|
||||||
|
transform=repr
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_cinder_index(self):
|
def test_cinder_index(self):
|
||||||
@ -85,5 +86,6 @@ class SystemInfoViewTests(test.BaseAdminViewTests):
|
|||||||
get_tab('cinder_services')
|
get_tab('cinder_services')
|
||||||
self.assertQuerysetEqual(
|
self.assertQuerysetEqual(
|
||||||
cinder_services_tab._tables['cinder_services'].data,
|
cinder_services_tab._tables['cinder_services'].data,
|
||||||
[service.__repr__() for service in self.cinder_services.list()]
|
[service.__repr__() for service in self.cinder_services.list()],
|
||||||
|
transform=repr
|
||||||
)
|
)
|
||||||
|
@ -202,7 +202,8 @@ class CreateDomainWorkflowTests(test.BaseAdminViewTests):
|
|||||||
workflows.CreateDomain.name)
|
workflows.CreateDomain.name)
|
||||||
|
|
||||||
self.assertQuerysetEqual(workflow.steps,
|
self.assertQuerysetEqual(workflow.steps,
|
||||||
['<CreateDomainInfo: create_domain>', ])
|
['<CreateDomainInfo: create_domain>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
@test.create_mocks({api.keystone: ('domain_create', )})
|
@test.create_mocks({api.keystone: ('domain_create', )})
|
||||||
def test_add_domain_post(self):
|
def test_add_domain_post(self):
|
||||||
@ -300,7 +301,8 @@ class UpdateDomainWorkflowTests(test.BaseAdminViewTests):
|
|||||||
workflow.steps,
|
workflow.steps,
|
||||||
['<UpdateDomainInfo: update_domain>',
|
['<UpdateDomainInfo: update_domain>',
|
||||||
'<UpdateDomainUsers: update_user_members>',
|
'<UpdateDomainUsers: update_user_members>',
|
||||||
'<UpdateDomainGroups: update_group_members>'])
|
'<UpdateDomainGroups: update_group_members>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
self.mock_domain_get.assert_called_once_with(test.IsHttpRequest(), '1')
|
self.mock_domain_get.assert_called_once_with(test.IsHttpRequest(), '1')
|
||||||
self.assert_mock_multiple_calls_with_same_arguments(
|
self.assert_mock_multiple_calls_with_same_arguments(
|
||||||
|
@ -209,7 +209,8 @@ class CreateProjectWorkflowTests(test.BaseAdminViewTests):
|
|||||||
workflow.steps,
|
workflow.steps,
|
||||||
['<CreateProjectInfo: createprojectinfoaction>',
|
['<CreateProjectInfo: createprojectinfoaction>',
|
||||||
'<UpdateProjectMembers: update_members>',
|
'<UpdateProjectMembers: update_members>',
|
||||||
'<UpdateProjectGroups: update_group_members>'])
|
'<UpdateProjectGroups: update_group_members>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
self.mock_get_default_domain.assert_called_once_with(
|
self.mock_get_default_domain.assert_called_once_with(
|
||||||
test.IsHttpRequest())
|
test.IsHttpRequest())
|
||||||
@ -581,7 +582,8 @@ class UpdateProjectWorkflowTests(test.BaseAdminViewTests):
|
|||||||
workflow.steps,
|
workflow.steps,
|
||||||
['<UpdateProjectInfo: update_info>',
|
['<UpdateProjectInfo: update_info>',
|
||||||
'<UpdateProjectMembers: update_members>',
|
'<UpdateProjectMembers: update_members>',
|
||||||
'<UpdateProjectGroups: update_group_members>'])
|
'<UpdateProjectGroups: update_group_members>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
self.mock_tenant_get.assert_called_once_with(
|
self.mock_tenant_get.assert_called_once_with(
|
||||||
test.IsHttpRequest(), self.tenant.id, admin=True)
|
test.IsHttpRequest(), self.tenant.id, admin=True)
|
||||||
@ -1009,7 +1011,8 @@ class UpdateQuotasWorkflowTests(test.BaseAdminViewTests):
|
|||||||
self.assertQuerysetEqual(
|
self.assertQuerysetEqual(
|
||||||
workflow.steps,
|
workflow.steps,
|
||||||
['<UpdateComputeQuota: update_compute_quotas>',
|
['<UpdateComputeQuota: update_compute_quotas>',
|
||||||
'<UpdateVolumeQuota: update_volume_quotas>'])
|
'<UpdateVolumeQuota: update_volume_quotas>'],
|
||||||
|
transform=repr)
|
||||||
|
|
||||||
self.mock_get_disabled_quotas.assert_called_once_with(
|
self.mock_get_disabled_quotas.assert_called_once_with(
|
||||||
test.IsHttpRequest())
|
test.IsHttpRequest())
|
||||||
|
@ -2214,7 +2214,8 @@ class InstanceTests2(InstanceTestBase, InstanceTableTestMixin):
|
|||||||
'Disk Partition')
|
'Disk Partition')
|
||||||
self.assertQuerysetEqual(workflow.steps,
|
self.assertQuerysetEqual(workflow.steps,
|
||||||
['<SetFlavorChoice: flavor_choice>',
|
['<SetFlavorChoice: flavor_choice>',
|
||||||
'<SetAdvanced: setadvancedaction>'])
|
'<SetAdvanced: setadvancedaction>'],
|
||||||
|
transform=repr)
|
||||||
option = '<option value="%s">%s</option>'
|
option = '<option value="%s">%s</option>'
|
||||||
|
|
||||||
def is_original_flavor(server, flavor, nova_api_lt_2_47):
|
def is_original_flavor(server, flavor, nova_api_lt_2_47):
|
||||||
|
@ -387,7 +387,7 @@ class NetworkTests(test.TestCase, NetworkStubMixin):
|
|||||||
expected_objs = ['<CreateNetworkInfo: createnetworkinfoaction>',
|
expected_objs = ['<CreateNetworkInfo: createnetworkinfoaction>',
|
||||||
'<CreateSubnetInfo: createsubnetinfoaction>',
|
'<CreateSubnetInfo: createsubnetinfoaction>',
|
||||||
'<CreateSubnetDetail: createsubnetdetailaction>']
|
'<CreateSubnetDetail: createsubnetdetailaction>']
|
||||||
self.assertQuerysetEqual(workflow.steps, expected_objs)
|
self.assertQuerysetEqual(workflow.steps, expected_objs, transform=repr)
|
||||||
self._check_is_extension_supported({'network_availability_zone': 1,
|
self._check_is_extension_supported({'network_availability_zone': 1,
|
||||||
'subnet_allocation': 1})
|
'subnet_allocation': 1})
|
||||||
self.mock_subnetpool_list.assert_called_once_with(test.IsHttpRequest())
|
self.mock_subnetpool_list.assert_called_once_with(test.IsHttpRequest())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user