def test_password_saved(self): """The password is not set when it is not found in the metadata service.""" httpretty.register_uri(httpretty.GET, self.password_url, body="saved_password") self.assertFalse(get_password())
def test_password(self): """The password is set to what is found in the metadata service.""" expected_password = "******" httpretty.register_uri(httpretty.GET, self.password_url, body=expected_password) password = get_password() self.assertEqual(expected_password, password)
def test_password_empty(self): """No password is set if the metadata service returns an empty string.""" httpretty.register_uri(httpretty.GET, self.password_url, body="") self.assertFalse(get_password())