Esempio n. 1
0
 def test_compose_preseed_includes_metadata_url(self):
     osystem = WindowsOS()
     node = self.make_node()
     token = self.make_token()
     url = factory.make_name("url")
     preseed = osystem.compose_preseed("default", node, token, url)
     self.assertEqual(url, preseed["maas_metadata_url"])
Esempio n. 2
0
 def test_compose_preseed_truncates_hostname(self):
     osystem = WindowsOS()
     machine = factory.make_name("hostname", size=20)
     dns = factory.make_name("dns")
     hostname = "%s.%s" % (machine, dns)
     node = self.make_node(hostname=hostname)
     token = self.make_token()
     url = factory.make_name("url")
     preseed = osystem.compose_preseed("default", node, token, url)
     self.assertEqual(15, len(preseed["hostname"]))
Esempio n. 3
0
 def test_compose_preseed_truncates_hostname(self):
     osystem = WindowsOS()
     machine = factory.make_name('hostname', size=20)
     dns = factory.make_name('dns')
     hostname = '%s.%s' % (machine, dns)
     node = self.make_node(hostname=hostname)
     token = self.make_token()
     url = factory.make_name('url')
     preseed = osystem.compose_preseed('default', node, token, url)
     self.assertEqual(15, len(preseed['hostname']))
Esempio n. 4
0
 def test_compose_preseed_has_required_keys(self):
     osystem = WindowsOS()
     node = self.make_node()
     token = self.make_token()
     url = factory.make_name("url")
     required_keys = [
         "maas_metadata_url",
         "maas_oauth_consumer_secret",
         "maas_oauth_consumer_key",
         "maas_oauth_token_key",
         "maas_oauth_token_secret",
         "hostname",
     ]
     preseed = osystem.compose_preseed("default", node, token, url)
     self.assertItemsEqual(required_keys, preseed.keys())
Esempio n. 5
0
 def test_compose_preseed_includes_oauth(self):
     osystem = WindowsOS()
     node = self.make_node()
     consumer_key = factory.make_name('consumer_key')
     token_key = factory.make_name('token_key')
     token_secret = factory.make_name('secret_key')
     token = self.make_token(consumer_key=consumer_key,
                             token_key=token_key,
                             token_secret=token_secret)
     url = factory.make_name('url')
     preseed = osystem.compose_preseed('default', node, token, url)
     self.assertEqual('', preseed['maas_oauth_consumer_secret'])
     self.assertEqual(consumer_key, preseed['maas_oauth_consumer_key'])
     self.assertEqual(token_key, preseed['maas_oauth_token_key'])
     self.assertEqual(token_secret, preseed['maas_oauth_token_secret'])
Esempio n. 6
0
 def test_compose_preseed_has_required_keys(self):
     osystem = WindowsOS()
     node = self.make_node()
     token = self.make_token()
     url = factory.make_name('url')
     required_keys = [
         'maas_metadata_url',
         'maas_oauth_consumer_secret',
         'maas_oauth_consumer_key',
         'maas_oauth_token_key',
         'maas_oauth_token_secret',
         'hostname',
     ]
     preseed = osystem.compose_preseed('default', node, token, url)
     self.assertItemsEqual(required_keys, preseed.keys())
Esempio n. 7
0
 def test_compose_preseed_includes_oauth(self):
     osystem = WindowsOS()
     node = self.make_node()
     consumer_key = factory.make_name("consumer_key")
     token_key = factory.make_name("token_key")
     token_secret = factory.make_name("secret_key")
     token = self.make_token(
         consumer_key=consumer_key,
         token_key=token_key,
         token_secret=token_secret,
     )
     url = factory.make_name("url")
     preseed = osystem.compose_preseed("default", node, token, url)
     self.assertEqual("", preseed["maas_oauth_consumer_secret"])
     self.assertEqual(consumer_key, preseed["maas_oauth_consumer_key"])
     self.assertEqual(token_key, preseed["maas_oauth_token_key"])
     self.assertEqual(token_secret, preseed["maas_oauth_token_secret"])