コード例 #1
0
    def test_auth_with_no_public_routes(self):
        # All apis need auth when access
        paste_file = "magnum/tests/unit/api/controllers/auth-paste.ini"
        app = self.make_app(paste_file)

        response = app.get('/', expect_errors=True)
        self.assertEqual(401, response.status_int)

        response = app.get('/v1/', expect_errors=True)
        self.assertEqual(401, response.status_int)
コード例 #2
0
    def test_auth_with_v1_access(self):
        # Only /v1 can access without auth
        paste_file = "magnum/tests/unit/api/controllers/auth-v1-access.ini"
        app = self.make_app(paste_file)

        response = app.get('/', expect_errors=True)
        self.assertEqual(401, response.status_int)

        response = app.get('/v1/')
        self.assertEqual(self.v1_expected, response.json)

        response = app.get('/v1/baymodels', expect_errors=True)
        self.assertEqual(401, response.status_int)
コード例 #3
0
    def test_noauth(self):
        # Don't need to auth
        paste_file = "magnum/tests/unit/api/controllers/noauth-paste.ini"
        app = self.make_app(paste_file)

        response = app.get('/')
        self.assertEqual(self.root_expected, response.json)

        response = app.get('/v1/')
        self.assertEqual(self.v1_expected, response.json)

        response = app.get('/v1/baymodels')
        self.assertEqual(200, response.status_int)