Merge pull request #1530 from efiop/master

remote: gs: don't forget to set projectname
This commit is contained in:
Ruslan Kuprieiev
2019-01-26 14:08:07 +02:00
committed by GitHub
2 changed files with 26 additions and 1 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ class RemoteGS(RemoteBase):
@property
def gs(self):
return storage.Client()
return storage.Client(self.projectname)
def get_md5(self, bucket, path):
import base64
+25
View File
@@ -0,0 +1,25 @@
import mock
from unittest import TestCase
from dvc.remote.gs import RemoteGS
class TestRemoteGS(TestCase):
BUCKET = 'bucket'
PREFIX = 'prefix'
URL = 'gs://{}/{}'.format(BUCKET, PREFIX)
PROJECT = 'PROJECT'
CONFIG = {'projectname': PROJECT, 'url': URL}
def test_init(self):
remote = RemoteGS(None, self.CONFIG)
self.assertEqual(remote.url, self.URL)
self.assertEqual(remote.prefix, self.PREFIX)
self.assertEqual(remote.bucket, self.BUCKET)
self.assertEqual(remote.projectname, self.PROJECT)
@mock.patch('google.cloud.storage.Client')
def test_gs(self, mock_client):
remote = RemoteGS(None, self.CONFIG)
remote.gs()
mock_client.assert_called_with(self.PROJECT)