You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: service_test.go
    path of file: ./repos/storj/satellite/console/restkeys
    
    the code of the file until where you have to start completion: // Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.

package restkeys_test

import (
	"database/sql"
	"testing"
	"time"

	"github.com/stretchr/testify/require"

	"storj.io/common/testcontext"
	"storj.io/common/testrand"
	"storj.io/storj/private/testplanet"
	"storj.io/storj/satellite/console/restkeys"
	"storj.io/storj/satellite/oidc"
)

func TestRESTKeys(t *testing.T) {
	testplanet.Run(t, testplanet.Config{
		SatelliteCount: 1, StorageNodeCount: 0, UplinkCount: 1,
	}, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {
		sat := planet.Satellites[0]
		service := sat.API.REST.Keys

		id := testrand.UUID()
		now := time.Now()
		expires := time.Hour
		apiKey, _, err := service.Create(ctx, id, expires)
		require.NoError(t, err)

		// test GetUserFromKey
		userID, exp, err := service.GetUserAndExpirationFromKey(ctx, apiKey)
		require.NoError(t, err)
		require.Equal(t, id, userID)
		require.False(t, exp.IsZero())
		requir
    
func TestRESTKeysExpiration(t *testing.T) {
	testplanet.Run(t, testplanet.Config{
		SatelliteCount: 1, StorageNodeCount: 0, UplinkCount: 1,
	}, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {
		sat := planet.Satellites[0]
		service := sat.API.REST.Keys
		now := time.Now()

		// test no expiration uses default
		expiresAt, err := service.InsertIntoDB(ctx, oidc.OAuthToken{
			UserID: testrand.UUID(),
			Kind:   oidc.KindRESTTokenV0,
			Token:  "testhash0",
		}, now, 0)
		require.NoError(t, err)
		require.Equal(t, now.Add(sat.Config.RESTKeys.DefaultExpiration), expiresAt)

		// test negative expiration uses default
		expiresAt, err = service.InsertIntoDB(ctx, oidc.OAuthToken{
			UserID: testrand.UUID(),
			Kind:   oidc.KindRESTTokenV0,
			Token:  "testhash1",
		}, now, -10000)
		require.NoError(t, err)
		require.Equal(t, now.Add(sat.Config.RESTKeys.DefaultExpiration), expiresAt)

		// test regular expiration
		expiration := 14 * time.Hour
		expiresAt, err = service.InsertIntoDB(ctx, oidc.OAuthToken{
			UserID: testrand.UUID(),
			Kind:   oidc.KindRESTTokenV0,
			Token:  "testhash2",
		}, now, expiration)
		require.NoError(t, err)
		require.Equal(t, now.Add(expiration), expiresAt)
	})
}