@@ -43,7 +43,7 @@ class TestClient(unittest.TestCase):
43
43
44
44
@staticmethod
45
45
def _get_target_class ():
46
- from google .cloud .logging_v2 . client import Client
46
+ from google .cloud .logging import Client
47
47
48
48
return Client
49
49
@@ -238,7 +238,7 @@ def make_api(client_obj):
238
238
self .assertIs (again , api )
239
239
240
240
def test_logger (self ):
241
- from google .cloud .logging_v2 . logger import Logger
241
+ from google .cloud .logging import Logger
242
242
243
243
creds = _make_credentials ()
244
244
client = self ._make_one (project = self .PROJECT , credentials = creds )
@@ -249,7 +249,7 @@ def test_logger(self):
249
249
self .assertEqual (logger .project , self .PROJECT )
250
250
251
251
def test_list_entries_defaults (self ):
252
- from google .cloud .logging_v2 . entries import TextEntry
252
+ from google .cloud .logging import TextEntry
253
253
254
254
IID = "IID"
255
255
TEXT = "TEXT"
@@ -308,10 +308,10 @@ def test_list_entries_defaults(self):
308
308
self .assertLess (yesterday - timestamp , timedelta (minutes = 1 ))
309
309
310
310
def test_list_entries_explicit (self ):
311
- from google .cloud .logging_v2 import DESCENDING
312
- from google .cloud .logging_v2 . entries import ProtobufEntry
313
- from google .cloud .logging_v2 . entries import StructEntry
314
- from google .cloud .logging_v2 . logger import Logger
311
+ from google .cloud .logging import DESCENDING
312
+ from google .cloud .logging import ProtobufEntry
313
+ from google .cloud .logging import StructEntry
314
+ from google .cloud .logging import Logger
315
315
316
316
PROJECT1 = "PROJECT1"
317
317
PROJECT2 = "PROJECT2"
@@ -404,10 +404,10 @@ def test_list_entries_explicit(self):
404
404
self .assertLess (yesterday - timestamp , timedelta (minutes = 1 ))
405
405
406
406
def test_list_entries_explicit_timestamp (self ):
407
- from google .cloud .logging_v2 import DESCENDING
408
- from google .cloud .logging_v2 . entries import ProtobufEntry
409
- from google .cloud .logging_v2 . entries import StructEntry
410
- from google .cloud .logging_v2 . logger import Logger
407
+ from google .cloud .logging import DESCENDING
408
+ from google .cloud .logging import ProtobufEntry
409
+ from google .cloud .logging import StructEntry
410
+ from google .cloud .logging import Logger
411
411
412
412
PROJECT1 = "PROJECT1"
413
413
PROJECT2 = "PROJECT2"
@@ -492,7 +492,7 @@ def test_list_entries_explicit_timestamp(self):
492
492
)
493
493
494
494
def test_sink_defaults (self ):
495
- from google .cloud .logging_v2 . sink import Sink
495
+ from google .cloud .logging import Sink
496
496
497
497
creds = _make_credentials ()
498
498
client = self ._make_one (project = self .PROJECT , credentials = creds )
@@ -505,7 +505,7 @@ def test_sink_defaults(self):
505
505
self .assertEqual (sink .parent , self .PROJECT_PATH )
506
506
507
507
def test_sink_explicit (self ):
508
- from google .cloud .logging_v2 . sink import Sink
508
+ from google .cloud .logging import Sink
509
509
510
510
creds = _make_credentials ()
511
511
client = self ._make_one (project = self .PROJECT , credentials = creds )
@@ -520,7 +520,7 @@ def test_sink_explicit(self):
520
520
self .assertEqual (sink .parent , self .PROJECT_PATH )
521
521
522
522
def test_list_sinks_no_paging (self ):
523
- from google .cloud .logging_v2 . sink import Sink
523
+ from google .cloud .logging import Sink
524
524
525
525
PROJECT = "PROJECT"
526
526
TOKEN = "TOKEN"
@@ -559,7 +559,7 @@ def test_list_sinks_no_paging(self):
559
559
)
560
560
561
561
def test_list_sinks_with_paging (self ):
562
- from google .cloud .logging_v2 . sink import Sink
562
+ from google .cloud .logging import Sink
563
563
564
564
PROJECT = "PROJECT"
565
565
SINK_NAME = "sink_name"
@@ -603,7 +603,7 @@ def test_list_sinks_with_paging(self):
603
603
)
604
604
605
605
def test_metric_defaults (self ):
606
- from google .cloud .logging_v2 . metric import Metric
606
+ from google .cloud .logging import Metric
607
607
608
608
creds = _make_credentials ()
609
609
@@ -617,7 +617,7 @@ def test_metric_defaults(self):
617
617
self .assertEqual (metric .project , self .PROJECT )
618
618
619
619
def test_metric_explicit (self ):
620
- from google .cloud .logging_v2 . metric import Metric
620
+ from google .cloud .logging import Metric
621
621
622
622
creds = _make_credentials ()
623
623
@@ -633,7 +633,7 @@ def test_metric_explicit(self):
633
633
self .assertEqual (metric .project , self .PROJECT )
634
634
635
635
def test_list_metrics_no_paging (self ):
636
- from google .cloud .logging_v2 . metric import Metric
636
+ from google .cloud .logging import Metric
637
637
638
638
metrics = [
639
639
{
@@ -669,7 +669,7 @@ def test_list_metrics_no_paging(self):
669
669
)
670
670
671
671
def test_list_metrics_with_paging (self ):
672
- from google .cloud .logging_v2 . metric import Metric
672
+ from google .cloud .logging import Metric
673
673
674
674
token = "TOKEN"
675
675
next_token = "T00KEN"
@@ -719,7 +719,7 @@ def test_get_default_handler_app_engine(self):
719
719
import os
720
720
from google .cloud ._testing import _Monkey
721
721
from google .cloud .logging_v2 .client import _APPENGINE_FLEXIBLE_ENV_VM
722
- from google .cloud .logging_v2 .handlers import AppEngineHandler
722
+ from google .cloud .logging .handlers import AppEngineHandler
723
723
724
724
credentials = _make_credentials ()
725
725
client = self ._make_one (
@@ -734,7 +734,7 @@ def test_get_default_handler_app_engine(self):
734
734
self .assertIsInstance (handler , AppEngineHandler )
735
735
736
736
def test_get_default_handler_container_engine (self ):
737
- from google .cloud .logging_v2 .handlers import ContainerEngineHandler
737
+ from google .cloud .logging .handlers import ContainerEngineHandler
738
738
739
739
credentials = _make_credentials ()
740
740
client = self ._make_one (
@@ -753,8 +753,8 @@ def test_get_default_handler_container_engine(self):
753
753
754
754
def test_get_default_handler_general (self ):
755
755
import io
756
- from google .cloud .logging_v2 .handlers import CloudLoggingHandler
757
- from google .cloud .logging_v2 . resource import Resource
756
+ from google .cloud .logging .handlers import CloudLoggingHandler
757
+ from google .cloud .logging import Resource
758
758
759
759
name = "test-logger"
760
760
resource = Resource ("resource_type" , {"resource_label" : "value" })
@@ -778,7 +778,7 @@ def test_get_default_handler_general(self):
778
778
self .assertEqual (handler .labels , labels )
779
779
780
780
def test_setup_logging (self ):
781
- from google .cloud .logging_v2 .handlers import CloudLoggingHandler
781
+ from google .cloud .logging .handlers import CloudLoggingHandler
782
782
783
783
credentials = _make_credentials ()
784
784
client = self ._make_one (
@@ -804,8 +804,8 @@ def test_setup_logging(self):
804
804
805
805
def test_setup_logging_w_extra_kwargs (self ):
806
806
import io
807
- from google .cloud .logging_v2 .handlers import CloudLoggingHandler
808
- from google .cloud .logging_v2 . resource import Resource
807
+ from google .cloud .logging .handlers import CloudLoggingHandler
808
+ from google .cloud .logging import Resource
809
809
810
810
name = "test-logger"
811
811
resource = Resource ("resource_type" , {"resource_label" : "value" })
0 commit comments