예제 #1
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)
예제 #2
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)
예제 #3
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)