File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,13 @@ def path(self):
7777 project = self .topic .project
7878 return '/projects/%s/subscriptions/%s' % (project , self .name )
7979
80+
81+ @path .setter
82+ def path (self , project ):
83+ """URL path setter"""
84+ self .path = '/projects/%s/subscriptions/%s' % (project , self .name )
85+
86+
8087 def create (self , connection = None ):
8188 """API call: create the subscription via a PUT request
8289
Original file line number Diff line number Diff line change @@ -456,6 +456,20 @@ def test_delete_w_explicit_connection(self):
456456 self .assertEqual (req ['method' ], 'DELETE' )
457457 self .assertEqual (req ['path' ], '/%s' % SUB_PATH )
458458
459+ def test_set_path_property (self ):
460+ PROJECT = 'PROJECT'
461+ NEW_PROJECT = 'NEW_PROJECT'
462+ SUB_NAME = 'sub_name'
463+ SUB_PATH = 'projects/%s/subscriptions/%s' % (PROJECT , SUB_NAME )
464+ NEW_SUB_PATH = 'projects/%s/subscriptions/%s' % (NEW_PROJECT , SUB_NAME )
465+ TOPIC_NAME = 'topic_name'
466+ conn = _Connection ({})
467+ topic = _Topic (TOPIC_NAME , project = PROJECT )
468+ subscription = self ._makeOne (SUB_NAME , topic )
469+ self .assertEqual (SUB_PATH ,subscription .path )
470+ subscription .path = NEW_PROJECT
471+ self .assertEqual (NEW_SUB_PATH , subscription .path )
472+
459473
460474class _Connection (object ):
461475
You can’t perform that action at this time.
0 commit comments