Skip to content

Commit

Permalink
Make copy config tests more detailed
Browse files Browse the repository at this point in the history
  • Loading branch information
plamut committed Jul 9, 2021
1 parent 5f21c2f commit 210517a
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions tests/unit/job/test_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ def _get_target_class():

return CopyJobConfig

def test_ctor_defaults(self):
from google.cloud.bigquery.job import OperationType

config = self._make_one()

assert config.create_disposition is None
assert config.write_disposition is None
assert config.destination_encryption_configuration is None
assert config.operation_type == OperationType.OPERATION_TYPE_UNSPECIFIED

def test_ctor_w_properties(self):
from google.cloud.bigquery.job import CreateDisposition
from google.cloud.bigquery.job import OperationType
Expand Down Expand Up @@ -76,19 +86,21 @@ def test_to_api_repr_with_encryption_none(self):
resource, {"copy": {"destinationEncryptionConfiguration": None}}
)

def test_operation_type_unspecified(self):
def test_operation_type_setting_none(self):
from google.cloud.bigquery.job import OperationType

config = self._make_one()
self.assertEqual(
config.operation_type, OperationType.OPERATION_TYPE_UNSPECIFIED
)
config = self._make_one(operation_type=OperationType.SNAPSHOT)

# Setting it to None is the same as setting it to OPERATION_TYPE_UNSPECIFIED.
config.operation_type = None
self.assertEqual(
config.operation_type, OperationType.OPERATION_TYPE_UNSPECIFIED
)
assert config.operation_type == OperationType.OPERATION_TYPE_UNSPECIFIED

def test_operation_type_setting_non_none(self):
from google.cloud.bigquery.job import OperationType

config = self._make_one(operation_type=None)
config.operation_type = OperationType.RESTORE
assert config.operation_type == OperationType.RESTORE


class TestCopyJob(_Base):
Expand Down

0 comments on commit 210517a

Please sign in to comment.