utils_test.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright 2015 Google Inc. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package bigquery
  15. import (
  16. "golang.org/x/net/context"
  17. bq "google.golang.org/api/bigquery/v2"
  18. )
  19. var defaultTable = &Table{
  20. ProjectID: "project-id",
  21. DatasetID: "dataset-id",
  22. TableID: "table-id",
  23. }
  24. var defaultGCS = &GCSReference{
  25. uris: []string{"uri"},
  26. }
  27. var defaultQuery = &Query{
  28. Q: "query string",
  29. DefaultProjectID: "def-project-id",
  30. DefaultDatasetID: "def-dataset-id",
  31. }
  32. type testService struct {
  33. *bq.Job
  34. service
  35. }
  36. func (s *testService) insertJob(ctx context.Context, job *bq.Job, projectID string) (*Job, error) {
  37. s.Job = job
  38. return &Job{}, nil
  39. }
  40. func (s *testService) jobStatus(ctx context.Context, projectID, jobID string) (*JobStatus, error) {
  41. return &JobStatus{State: Done}, nil
  42. }