def setUp(self): """ Instantiate a fresh MaaS object before every test """ # checking vor credentials if 'OS_USER' not in os.environ or 'OS_PWD' not in os.environ: raise AttributeError('Please provide OS_USER, OS_PWD as env vars.') if 'DESIGN_URI' in os.environ: kep = os.environ['DESIGN_URI'] else: kep = 'http://localhost:35357/v2.0' user = os.environ['OS_USER'] pwd = os.environ['OS_PWD'] # retrieve token for later usage if 'OS_TENANT' in os.environ: self.tenant = os.environ['OS_TENANT'] else: self.tenant = 'mcntub' keystone = client.Client(username=user, password=pwd, tenant_name=self.tenant, auth_url=kep) self.token = keystone.auth_token # instantiate class under test. self.cut = util.get_maas(self.token, tenant_name=self.tenant)
def test_class_attributes(self): """ Tests for correctly set class attributes when deploying two objects. """ self.cut2 = util.get_maas(self.token, tenant_name=self.tenant) self.assertEqual(self.cut.get_address(self.token), self.cut2.get_address(self.token), "Class variable address not correctly set!") self.assertEquals(self.cut.get_location(), self.cut2.get_location(), "Class variable location not correctly set!") self.assertEquals(self.cut.get_tenant(), self.cut2.get_tenant(), "Class variable tenant not correctly set!")
def test_get_maas_for_success(self): """ Test retrieval of maas. """ tmp = util.get_maas(self.token)