def test_collect_gcore(self): gcore_md = gcore.Collector(client=self.client).collect() self.assertThat(gcore_md, matchers.IsInstance(list)) self.assertEqual('gcore', gcore_md[0][0]) gcore_md = gcore_md[0][1] for k in ('int1', 'strfoo', 'map_ab'): self.assertIn(k, gcore_md) self.assertEqual(gcore_md[k], META_DATA[k]) # level setting for urllib3.connectionpool. self.assertTrue(self.log.output == '' or self.log.output == 'Starting new HTTP connection (1): 192.0.2.1\n')
def test_collect_gcore_no_project_id(self): cfg.CONF.gcore.project_id = None gcore_collect = gcore.Collector(client=self.client) self.assertRaises(exc.GcoreMetadataNotConfigured, gcore_collect.collect) self.assertIn('No project_id configured', self.log.output)
def test_collect_gcore_no_refresh_token(self): cfg.CONF.gcore.refresh_token = None gcore_collect = gcore.Collector(client=self.client) self.assertRaises(exc.GcoreMetadataNotConfigured, gcore_collect.collect) self.assertIn('No refresh_token configured', self.log.output)