launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #07282
[Merge] lp:~jtv/maas/pre-986185-loosen-tests into lp:maas
Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/pre-986185-loosen-tests into lp:maas.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #986185 in MAAS: "MAAS boots inaccessible nodes when there's no SSH registered for a given user"
https://bugs.launchpad.net/maas/+bug/986185
For more details, see:
https://code.launchpad.net/~jtv/maas/pre-986185-loosen-tests/+merge/103515
This is preparation for a larger branch I'm working on. Some tests will have to change: a form attribute that's going to disappear, an apostrophe that may or may not turn into an HTML entity code. This pries a few tests loose from some of the details that are going to change. Helps keep the main diff from growing out of hand.
Jeroen
--
https://code.launchpad.net/~jtv/maas/pre-986185-loosen-tests/+merge/103515
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/maas/pre-986185-loosen-tests into lp:maas.
=== modified file 'src/maasserver/tests/test_forms.py'
--- src/maasserver/tests/test_forms.py 2012-04-25 02:23:38 +0000
+++ src/maasserver/tests/test_forms.py 2012-04-25 16:56:29 +0000
@@ -48,10 +48,6 @@
from maasserver.testing.factory import factory
from maasserver.testing.testcase import TestCase
from provisioningserver.enum import POWER_TYPE_CHOICES
-from testtools.matchers import (
- AllMatch,
- Equals,
- )
class NodeWithMACAddressesFormTest(TestCase):
@@ -251,12 +247,18 @@
self.assertTrue(set(NODE_ACTIONS.keys()) <= allowed_states)
- def test_NODE_ACTIONS_dict(self):
+ def test_NODE_ACTIONS_dict_contains_only_accepted_keys(self):
actions = sum(NODE_ACTIONS.values(), [])
- keys = ['permission', 'display', 'execute', 'message']
- self.assertThat(
- [sorted(action.keys()) for action in actions],
- AllMatch(Equals(sorted(keys))))
+ accepted_keys = set([
+ 'permission',
+ 'inhibit',
+ 'display',
+ 'execute',
+ 'message',
+ ])
+ actual_keys = set(sum([action.keys() for action in actions], []))
+ unknown_keys = actual_keys - accepted_keys
+ self.assertEqual(set(), unknown_keys)
class TestNodeActionForm(TestCase):
@@ -314,7 +316,7 @@
self.assertIsInstance(form, NodeActionForm)
self.assertEqual(node, form.node)
- self.assertItemsEqual({}, form.action_dict)
+ self.assertItemsEqual({}, form.action_buttons)
def test_get_action_form_node_for_admin_save(self):
admin = factory.make_admin()
=== modified file 'src/maasserver/tests/test_views_nodes.py'
--- src/maasserver/tests/test_views_nodes.py 2012-04-25 13:03:13 +0000
+++ src/maasserver/tests/test_views_nodes.py 2012-04-25 16:56:29 +0000
@@ -156,7 +156,7 @@
self.assertEqual(httplib.OK, response.status_code)
self.assertNotIn(node_delete_link, get_content_links(response))
self.assertIn(
- "You cannot delete this node because it's in use.",
+ "You cannot delete this node because",
response.content)
def test_allocated_node_cannot_be_deleted(self):