예제 #1
0
파일: test_node.py 프로젝트: tjjh89017/maas
 def test_accepts_disable_ipv4_if_false(self):
     form = NodeForm(
         data={
             'architecture': make_usable_architecture(self),
             'disable_ipv4': False,
         })
     form.save()
예제 #2
0
파일: test_node.py 프로젝트: zhangrb/maas
 def test_rejects_disable_ipv4_if_true(self):
     form = NodeForm(
         data={
             'architecture': make_usable_architecture(self),
             'disable_ipv4': True,
             })
     self.assertFalse(form.is_valid())
예제 #3
0
    def test_validates_domain(self):
        machine = factory.make_Node()
        patch_usable_architectures(self, [machine.architecture])

        form = NodeForm(data={"domain": factory.make_name("domain")},
                        instance=machine)

        self.assertFalse(form.is_valid())
예제 #4
0
파일: test_node.py 프로젝트: tai271828/maas
    def test_accepts_domain_by_id(self):
        machine = factory.make_Node()
        domain = factory.make_Domain()
        patch_usable_architectures(self, [machine.architecture])

        form = NodeForm(data={"domain": domain.id}, instance=machine)
        form.save()

        self.assertEqual(domain.name, machine.domain.name)
예제 #5
0
파일: test_node.py 프로젝트: tjjh89017/maas
    def test_accepts_hostname(self):
        machine = factory.make_Node()
        hostname = factory.make_string()
        patch_usable_architectures(self, [machine.architecture])

        form = NodeForm(data={
            'hostname': hostname,
            'architecture': make_usable_architecture(self),
        },
                        instance=machine)
        form.save()

        self.assertEqual(hostname, machine.hostname)
예제 #6
0
파일: test_node.py 프로젝트: tai271828/maas
    def test_contains_limited_set_of_fields(self):
        form = NodeForm()

        self.assertItemsEqual(
            ["hostname", "domain", "disable_ipv4", "swap_size"],
            list(form.fields),
        )
예제 #7
0
파일: test_node.py 프로젝트: tjjh89017/maas
    def test_contains_limited_set_of_fields(self):
        form = NodeForm()

        self.assertItemsEqual([
            'hostname',
            'domain',
            'disable_ipv4',
            'swap_size',
        ], list(form.fields))
예제 #8
0
    def test_NodeForm_changes_node(self):
        node = factory.make_node()
        hostname = factory.getRandomString()
        after_commissioning_action = factory.getRandomChoice(
            NODE_AFTER_COMMISSIONING_ACTION_CHOICES)

        form = NodeForm(
            data={
                'hostname': hostname,
                'after_commissioning_action': after_commissioning_action,
                'architecture': factory.getRandomChoice(ARCHITECTURE_CHOICES),
                },
            instance=node)
        form.save()

        self.assertEqual(hostname, node.hostname)
        self.assertEqual(
            after_commissioning_action, node.after_commissioning_action)