~free.ekanayaka/landscape-client/use-smart-to-get-dpkg-arch

« back to all changes in this revision

Viewing changes to landscape/broker/tests/test_registration.py

  • Committer: Kevin McDermott
  • Date: 2009-06-16 16:37:23 UTC
  • mfrom: (115.1.3 client-sends-fqdn)
  • Revision ID: kevin@canonical.com-20090616163723-ybp8nwg0ssr5fm28
Merge client-sends-fqdn [r=therve,free] [f=385730]

This changes the client to use socket.getfqdn() rather than
socket.gethostname() which should send the fully-qualified domain name back to
the server.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
        self.identity = self.broker_service.identity
26
26
        self.handler = self.broker_service.registration
27
27
        logging.getLogger().setLevel(logging.INFO)
28
 
        self.hostname = "ooga"
29
 
        self.addCleanup(setattr, socket, "gethostname", socket.gethostname)
30
 
        socket.gethostname = lambda: self.hostname
 
28
        self.hostname = "ooga.local"
 
29
        self.addCleanup(setattr, socket, "getfqdn", socket.getfqdn)
 
30
        socket.getfqdn = lambda: self.hostname
31
31
 
32
32
    def check_persist_property(self, attr, persist_name):
33
33
        value = "VALUE"
143
143
                              "computer_title": "Computer Title",
144
144
                              "account_name": "account_name",
145
145
                              "registration_password": None,
146
 
                              "hostname": "ooga"}
 
146
                              "hostname": "ooga.local"}
147
147
                            ])
148
148
        self.assertEquals(self.logfile.getvalue().strip(),
149
149
                          "INFO: Queueing message to register with account "
161
161
                              "computer_title": "Computer Title",
162
162
                              "account_name": "account_name",
163
163
                              "registration_password": "SEKRET",
164
 
                              "hostname": "ooga"}
 
164
                              "hostname": "ooga.local"}
165
165
                            ])
166
166
        self.assertEquals(self.logfile.getvalue().strip(),
167
167
                          "INFO: Queueing message to register with account "
343
343
                              "computer_title": "Computer Title",
344
344
                              "account_name": "account_name",
345
345
                              "registration_password": "SEKRET",
346
 
                              "hostname": socket.gethostname()}
 
346
                              "hostname": socket.getfqdn()}
347
347
                             ])
348
348
 
349
349
    def get_registration_handler_for_cloud(
408
408
        """
409
409
        message = dict(type="register-cloud-vm",
410
410
                       otp="otp1",
411
 
                       hostname="ooga",
 
411
                       hostname="ooga.local",
412
412
                       local_hostname="ooga.local",
413
413
                       public_hostname="ooga.amazon.com",
414
414
                       instance_key=u"key1",
643
643
                              "computer_title": u"whatever",
644
644
                              "account_name": u"onward",
645
645
                              "registration_password": u"password",
646
 
                              "hostname": socket.gethostname()}])
 
646
                              "hostname": socket.getfqdn()}])
647
647
 
648
648
    def test_should_register_in_cloud(self):
649
649
        """