Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(244)  |  Call(244)  |  Derive(0)  |  Import(0)
Fail if the two objects are unequal as determined by the '=='
operator.

src/g/s/gsutil-3.42/gslib/tests/test_update.py   gsutil(Download)
                         stderr=subprocess.PIPE)
    (_, stderr) = p.communicate()
    self.assertEqual(p.returncode, 1)
    self.assertIn('update command only works with tar.gz', stderr)
 
        cwd=gsutil_dst, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    (_, stderr) = p.communicate()
    self.assertEqual(p.returncode, 1)
    self.assertIn('non-existent object', stderr)
 
                         stderr=subprocess.PIPE)
    (_, stderr) = p.communicate()
    self.assertEqual(p.returncode, 1)
    self.assertIn('command does not support', stderr)
 
    # this file around.
    os.unlink(os.path.join(gsutil_dst, 'userdata.txt'))
    self.assertEqual(p.returncode, 1)
    self.assertIn(
        'The update command cannot run with user data in the gsutil directory',
                         stderr=subprocess.PIPE, stdin=subprocess.PIPE)
    (_, stderr) = p.communicate(input='y\r\n')
    self.assertEqual(p.returncode, 0, msg=(
        'Non-zero return code (%d) from gsutil update. stderr = \n%s' %
        (p.returncode, stderr)))

src/g/s/gsutil-HEAD/gslib/tests/test_update.py   gsutil(Download)
                         stderr=subprocess.PIPE)
    (_, stderr) = p.communicate()
    self.assertEqual(p.returncode, 1)
    self.assertIn('update command only works with tar.gz', stderr)
 
        cwd=gsutil_dst, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    (_, stderr) = p.communicate()
    self.assertEqual(p.returncode, 1)
    self.assertIn('non-existent object', stderr)
 
                         stderr=subprocess.PIPE)
    (_, stderr) = p.communicate()
    self.assertEqual(p.returncode, 1)
    self.assertIn('command does not support', stderr)
 
    # this file around.
    os.unlink(os.path.join(gsutil_dst, 'userdata.txt'))
    self.assertEqual(p.returncode, 1)
    self.assertIn(
        'The update command cannot run with user data in the gsutil directory',
                         stderr=subprocess.PIPE, stdin=subprocess.PIPE)
    (_, stderr) = p.communicate(input='y\r\n')
    self.assertEqual(p.returncode, 0, msg=(
        'Non-zero return code (%d) from gsutil update. stderr = \n%s' %
        (p.returncode, stderr)))

src/g/s/gsutil-3.42/gslib/tests/test_cp.py   gsutil(Download)
                            return_stderr=True)
    self.assertIn('Skipping existing item: %s' % suri(key_uri), stderr)
    self.assertEqual(key_uri.get_contents_as_string(), 'foo')
    stderr = self.RunGsUtil(['cp', '-n', suri(key_uri), fpath],
                            return_stderr=True)
    with open(fpath, 'r') as f:
      self.assertIn('Skipping existing item: %s' % suri(f), stderr)
      self.assertEqual(f.read(), 'bar')
    stderr = self.RunGsUtil(['cp', suri(key_uri), suri(bucket2_uri)],
                            return_stderr=True)
    self.assertEqual(stderr.count('Copying'), 1)
    stderr = self.RunGsUtil(['cp', '-n', suri(key_uri), suri(bucket2_uri)],
                            return_stderr=True)
    self.assertIn('Copying from <STDIN>', stderr)
    key_uri = bucket_uri.clone_replace_name('foo')
    self.assertEqual(key_uri.get_contents_as_string(), 'bar')
 
  @unittest.skipUnless(HAS_S3_CREDS, 'Test requires S3 credentials.')
    self.RunGsUtil(['cp', k2_uri.versionless_uri, fpath])
    with open(fpath, 'r') as f:
      self.assertEqual(f.read(), 'data3')
 
    # Check contents of all three versions

src/g/s/gsutil-HEAD/gslib/tests/test_cp.py   gsutil(Download)
                            return_stderr=True)
    self.assertIn('Skipping existing item: %s' % suri(key_uri), stderr)
    self.assertEqual(key_uri.get_contents_as_string(), 'foo')
    stderr = self.RunGsUtil(['cp', '-n', suri(key_uri), fpath],
                            return_stderr=True)
    with open(fpath, 'r') as f:
      self.assertIn('Skipping existing item: %s' % suri(f), stderr)
      self.assertEqual(f.read(), 'bar')
    stderr = self.RunGsUtil(['cp', suri(key_uri), suri(bucket2_uri)],
                            return_stderr=True)
    self.assertEqual(stderr.count('Copying'), 1)
    stderr = self.RunGsUtil(['cp', '-n', suri(key_uri), suri(bucket2_uri)],
                            return_stderr=True)
    self.assertIn('Copying from <STDIN>', stderr)
    key_uri = bucket_uri.clone_replace_name('foo')
    self.assertEqual(key_uri.get_contents_as_string(), 'bar')
 
  @unittest.skipUnless(HAS_S3_CREDS, 'Test requires S3 credentials.')
    self.RunGsUtil(['cp', k2_uri.versionless_uri, fpath])
    with open(fpath, 'r') as f:
      self.assertEqual(f.read(), 'data3')
 
    # Check contents of all three versions

src/g/s/gsutil-3.42/gslib/tests/test_cors.py   gsutil(Download)
  def test_default_cors(self):
    bucket_uri = self.CreateBucket()
    stdout = self.RunGsUtil(self._get_cmd_prefix + [suri(bucket_uri)],
                            return_stdout=True)
    self.assertEqual(stdout, self.empty_doc1)
    stdout = self.RunGsUtil(self._get_cmd_prefix + [suri(bucket_uri)],
                            return_stdout=True)
    self.assertEqual(stdout, self.empty_doc1)
 
  def test_set_empty_cors2(self):
    stdout = self.RunGsUtil(self._get_cmd_prefix + [suri(bucket_uri)],
                            return_stdout=True)
    self.assertEqual(stdout, self.empty_doc1)
 
  def test_set_empty_cors3(self):
    stdout = self.RunGsUtil(self._get_cmd_prefix + [suri(bucket_uri)],
                            return_stdout=True)
    self.assertEqual(stdout, self.empty_doc3)
 
  def test_set_empty_cors4(self):
    stdout = self.RunGsUtil(self._get_cmd_prefix + [suri(bucket_uri)],
                            return_stdout=True)
    self.assertEqual(stdout, self.empty_doc3)
 
  def test_non_null_cors(self):

src/g/s/gsutil-HEAD/gslib/tests/test_cors.py   gsutil(Download)
  def test_default_cors(self):
    bucket_uri = self.CreateBucket()
    stdout = self.RunGsUtil(self._get_cmd_prefix + [suri(bucket_uri)],
                            return_stdout=True)
    self.assertEqual(stdout, self.empty_doc1)
    stdout = self.RunGsUtil(self._get_cmd_prefix + [suri(bucket_uri)],
                            return_stdout=True)
    self.assertEqual(stdout, self.empty_doc1)
 
  def test_set_empty_cors2(self):
    stdout = self.RunGsUtil(self._get_cmd_prefix + [suri(bucket_uri)],
                            return_stdout=True)
    self.assertEqual(stdout, self.empty_doc1)
 
  def test_set_empty_cors3(self):
    stdout = self.RunGsUtil(self._get_cmd_prefix + [suri(bucket_uri)],
                            return_stdout=True)
    self.assertEqual(stdout, self.empty_doc3)
 
  def test_set_empty_cors4(self):
    stdout = self.RunGsUtil(self._get_cmd_prefix + [suri(bucket_uri)],
                            return_stdout=True)
    self.assertEqual(stdout, self.empty_doc3)
 
  def test_non_null_cors(self):

src/g/s/gsutil-3.42/gslib/tests/test_lifecycle.py   gsutil(Download)
  def test_default_lifecycle(self):
    bucket_uri = self.CreateBucket()
    stdout = self.RunGsUtil(['lifecycle', 'get', suri(bucket_uri)],
                            return_stdout=True)
    self.assertEqual(stdout, self.empty_doc1)
    stdout = self.RunGsUtil(['lifecycle', 'get', suri(bucket_uri)],
                            return_stdout=True)
    self.assertEqual(stdout, self.empty_doc1)
 
  def test_set_empty_lifecycle2(self):
    stdout = self.RunGsUtil(['lifecycle', 'get', suri(bucket_uri)],
                            return_stdout=True)
    self.assertEqual(stdout, self.empty_doc1)
 
  def test_valid_lifecycle(self):
    stdout = self.RunGsUtil(['lifecycle', 'get', suri(bucket_uri)],
                            return_stdout=True)
    self.assertEqual(stdout, self.valid_doc)
 
  def test_bad_lifecycle1(self):
    stdout = self.RunGsUtil(['lifecycle', 'get', suri(bucket_uri)],
                            return_stdout=True)
    self.assertEqual(stdout, self.valid_doc)
 
    fpath = self.CreateTempFile(tmpdir=tmpdir, contents=self.empty_doc1)

src/g/s/gsutil-HEAD/gslib/tests/test_lifecycle.py   gsutil(Download)
  def test_default_lifecycle(self):
    bucket_uri = self.CreateBucket()
    stdout = self.RunGsUtil(['lifecycle', 'get', suri(bucket_uri)],
                            return_stdout=True)
    self.assertEqual(stdout, self.empty_doc1)
    stdout = self.RunGsUtil(['lifecycle', 'get', suri(bucket_uri)],
                            return_stdout=True)
    self.assertEqual(stdout, self.empty_doc1)
 
  def test_set_empty_lifecycle2(self):
    stdout = self.RunGsUtil(['lifecycle', 'get', suri(bucket_uri)],
                            return_stdout=True)
    self.assertEqual(stdout, self.empty_doc1)
 
  def test_valid_lifecycle(self):
    stdout = self.RunGsUtil(['lifecycle', 'get', suri(bucket_uri)],
                            return_stdout=True)
    self.assertEqual(stdout, self.valid_doc)
 
  def test_bad_lifecycle1(self):
    stdout = self.RunGsUtil(['lifecycle', 'get', suri(bucket_uri)],
                            return_stdout=True)
    self.assertEqual(stdout, self.valid_doc)
 
    fpath = self.CreateTempFile(tmpdir=tmpdir, contents=self.empty_doc1)

src/g/s/gsutil-3.42/gslib/tests/test_acl.py   gsutil(Download)
 
    self.assertNotEqual(acl_string, acl_string2)
    self.assertEqual(acl_string, acl_string3)
 
  def test_set_valid_permission_whitespace_object(self):
 
    self.assertNotEqual(acl_string, acl_string2)
    self.assertEqual(acl_string, acl_string3)
 
  def test_get_and_set_valid_object_acl_with_non_ascii_chars(self):
    self.assertNotEqual(acl_string, acl_string2)
    self.assertIn('AllAuthenticatedUsers', acl_string2)
    self.assertEqual(acl_string, acl_string3)
 
  def test_acl_set_version_specific_uri(self):
    def _GetVersions():
      stdout = self.RunGsUtil(['ls', '-a', uri.uri], return_stdout=True)
      lines = stdout.split('\n')
      # There should be 3 lines, counting final \n.
      self.assertEqual(len(lines), 3)
    # original ACL (since the version-less URI means the current version).
    acl = self.RunGsUtil(self._get_acl_prefix + [uri.uri], return_stdout=True)
    self.assertEqual(acl, orig_acls[0])
 
  def _strip_xml_whitespace(self, xml):

src/g/s/gsutil-HEAD/gslib/tests/test_acl.py   gsutil(Download)
 
    self.assertNotEqual(acl_string, acl_string2)
    self.assertEqual(acl_string, acl_string3)
 
  def test_set_valid_permission_whitespace_object(self):
 
    self.assertNotEqual(acl_string, acl_string2)
    self.assertEqual(acl_string, acl_string3)
 
  def test_get_and_set_valid_object_acl_with_non_ascii_chars(self):
    self.assertNotEqual(acl_string, acl_string2)
    self.assertIn('AllAuthenticatedUsers', acl_string2)
    self.assertEqual(acl_string, acl_string3)
 
  def test_acl_set_version_specific_uri(self):
    def _GetVersions():
      stdout = self.RunGsUtil(['ls', '-a', uri.uri], return_stdout=True)
      lines = stdout.split('\n')
      # There should be 3 lines, counting final \n.
      self.assertEqual(len(lines), 3)
    # original ACL (since the version-less URI means the current version).
    acl = self.RunGsUtil(self._get_acl_prefix + [uri.uri], return_stdout=True)
    self.assertEqual(acl, orig_acls[0])
 
  def _strip_xml_whitespace(self, xml):

  1 | 2 | 3  Next