コード例 #1
0
    def testUpload(self):
        version = 1337
        self.SetUpWorkdir(xml_version=version, gms_lib=True, source_prop=True)

        status = update.main([
            'upload', '--dry-run', '--skip-git', '--bucket', self.paths.bucket,
            '--config', self.paths.config_file, '--sdk-root',
            self.paths.sdk_root
        ])
        self.assertEqual(status, 0, 'the command should have succeeded.')

        # bucket should contain license, name = license.sha1
        self.assertTrue(os.path.isfile(self.paths.config_license_sha1))
        license_sha1 = _GetFileContent(self.paths.config_license_sha1)
        bucket_license = os.path.join(self.paths.bucket, str(version),
                                      license_sha1)
        self.assertTrue(os.path.isfile(bucket_license))
        self.assertEqual(_GetFileContent(bucket_license), self.DEFAULT_LICENSE)

        # bucket should contain zip, name = zip.sha1
        self.assertTrue(os.path.isfile(self.paths.config_zip_sha1))
        bucket_zip = os.path.join(self.paths.bucket, str(version),
                                  _GetFileContent(self.paths.config_zip_sha1))
        self.assertTrue(os.path.isfile(bucket_zip))

        # unzip, should contain expected files
        with zipfile.ZipFile(bucket_zip, "r") as bucket_zip_file:
            self.assertEqual(bucket_zip_file.namelist(),
                             ['dummy_file', 'res/values/version.xml'])
コード例 #2
0
  def testUpload(self):
    version = '2.3.4'
    self.SetUpWorkdir(
        gms_lib=True,
        config_version=version,
        source_prop=True)

    status = update.main([
        'upload',
        '--dry-run',
        '--skip-git',
        '--bucket', self.paths.bucket,
        '--config', self.paths.config_file,
        '--sdk-root', self.paths.gms.sdk_root
    ])
    self.assertEqual(status, 0, 'the command should have succeeded.')

    # bucket should contain license, name = content from LICENSE.sha1
    self.assertTrue(os.path.isfile(self.paths.config_license_sha1))
    license_sha1 = _GetFileContent(self.paths.config_license_sha1)
    bucket_license = os.path.join(self.paths.bucket, version, license_sha1)
    self.assertTrue(os.path.isfile(bucket_license))
    self.assertEqual(_GetFileContent(bucket_license), self.DEFAULT_LICENSE)

    # bucket should contain zip, name = content from zip.sha1
    self.assertTrue(os.path.isfile(self.paths.config_zip_sha1))
    bucket_zip = os.path.join(self.paths.bucket, str(version),
                              _GetFileContent(self.paths.config_zip_sha1))
    self.assertTrue(os.path.isfile(bucket_zip))

    # unzip, should contain expected files
    with zipfile.ZipFile(bucket_zip, "r") as bucket_zip_file:
      self.assertEqual(bucket_zip_file.namelist(),
                       ['com/google/android/gms/client/2.3.4/client-2.3.4.aar'])
コード例 #3
0
ファイル: update_test.py プロジェクト: 4con/hello-gn
  def testUpload(self):
    version = 1337
    self.SetUpWorkdir(
        xml_version=version,
        gms_lib=True,
        source_prop=True)

    status = update.main([
        'upload',
        '--dry-run',
        '--skip-git',
        '--bucket', self.paths.bucket,
        '--config', self.paths.config_file,
        '--sdk-root', self.paths.sdk_root
    ])
    self.assertEqual(status, 0, 'the command should have succeeded.')

    # bucket should contain license, name = license.sha1
    self.assertTrue(os.path.isfile(self.paths.config_license_sha1))
    license_sha1 = _GetFileContent(self.paths.config_license_sha1)
    bucket_license = os.path.join(self.paths.bucket, str(version),
                                  license_sha1)
    self.assertTrue(os.path.isfile(bucket_license))
    self.assertEqual(_GetFileContent(bucket_license), self.DEFAULT_LICENSE)

    # bucket should contain zip, name = zip.sha1
    self.assertTrue(os.path.isfile(self.paths.config_zip_sha1))
    bucket_zip = os.path.join(self.paths.bucket, str(version),
                              _GetFileContent(self.paths.config_zip_sha1))
    self.assertTrue(os.path.isfile(bucket_zip))

    # unzip, should contain expected files
    with zipfile.ZipFile(bucket_zip, "r") as bucket_zip_file:
      self.assertEqual(bucket_zip_file.namelist(),
                       ['dummy_file', 'res/values/version.xml'])
コード例 #4
0
ファイル: update_test.py プロジェクト: bopopescu/proto-quic
  def testUpload(self):
    version = '2.3.4'
    self.SetUpWorkdir(
        gms_lib=True,
        config_version=version,
        source_prop=True)

    status = update.main([
        'upload',
        '--dry-run',
        '--bucket', self.paths.bucket,
        '--config', self.paths.config_file,
        '--sdk-root', self.paths.gms.sdk_root
    ])
    self.assertEqual(status, 0, 'the command should have succeeded.')

    # bucket should contain license, name = content from LICENSE.sha1
    self.assertTrue(os.path.isfile(self.paths.config_license_sha1))
    license_sha1 = _GetFileContent(self.paths.config_license_sha1)
    bucket_license = os.path.join(self.paths.bucket, version, license_sha1)
    self.assertTrue(os.path.isfile(bucket_license))
    self.assertEqual(_GetFileContent(bucket_license), self.DEFAULT_LICENSE)

    # bucket should contain zip, name = content from zip.sha1
    self.assertTrue(os.path.isfile(self.paths.config_zip_sha1))
    bucket_zip = os.path.join(self.paths.bucket, str(version),
                              _GetFileContent(self.paths.config_zip_sha1))
    self.assertTrue(os.path.isfile(bucket_zip))

    # unzip, should contain expected files
    with zipfile.ZipFile(bucket_zip, "r") as bucket_zip_file:
      self.assertEqual(bucket_zip_file.namelist(),
                       ['com/google/android/gms/client/2.3.4/client-2.3.4.aar'])
コード例 #5
0
    def testDownloadAcceptedLicense(self):
        self.SetUpWorkdir(populate_bucket=True,
                          existing_license=self.DEFAULT_LICENSE)

        # License already accepted, no need to type
        status = update.main([
            'download',
            '--dry-run',
            '--bucket',
            self.paths.bucket,
            '--config',
            self.paths.config_file,
            '--sdk-root',
            self.paths.sdk_root,
        ])

        self.assertEqual(status, 0, 'the command should have succeeded.')

        # sdk_root should contain zip contents, zip sha1, license
        self.assertTrue(
            os.path.isfile(os.path.join(self.paths.gms_lib, 'dummy_file')))
        self.assertTrue(os.path.isfile(self.paths.gms_root_sha1))
        self.assertTrue(os.path.isfile(self.paths.gms_root_license))
        self.assertEquals(_GetFileContent(self.paths.gms_root_license),
                          self.DEFAULT_LICENSE)
コード例 #6
0
ファイル: update_test.py プロジェクト: bopopescu/proto-quic
  def testDownloadNoAndroidSDK(self):
    self.SetUpWorkdir(
        populate_bucket=True,
        existing_license='Old license')

    non_existing_sdk_root = os.path.join(self.workdir, 'non_existing_sdk_root')
    # Should not run, no typing needed
    status = update.main([
        'download',
        '--dry-run',
        '--bucket', self.paths.bucket,
        '--config', self.paths.config_file,
        '--sdk-root', non_existing_sdk_root,
    ])

    self.assertEqual(status, 0, 'the command should have succeeded.')
    self.assertFalse(os.path.isdir(non_existing_sdk_root))
コード例 #7
0
ファイル: update_test.py プロジェクト: 4con/hello-gn
  def testDownloadNoAndroidSDK(self):
    self.SetUpWorkdir(
        populate_bucket=True,
        existing_license='Old license')

    non_existing_sdk_root = os.path.join(self.workdir, 'non_existing_sdk_root')
    # Should not run, no typing needed
    status = update.main([
        'download',
        '--dry-run',
        '--bucket', self.paths.bucket,
        '--config', self.paths.config_file,
        '--sdk-root', non_existing_sdk_root,
    ])

    self.assertEqual(status, 0, 'the command should have succeeded.')
    self.assertFalse(os.path.isdir(non_existing_sdk_root))
コード例 #8
0
ファイル: update_test.py プロジェクト: 4con/hello-gn
  def testDownloadAlreadyUpToDate(self):
    self.SetUpWorkdir(
        populate_bucket=True,
        existing_zip_sha1=self.DEFAULT_ZIP_SHA1)

    status = update.main([
        'download',
        '--dry-run',
        '--bucket', self.paths.bucket,
        '--config', self.paths.config_file,
        '--sdk-root', self.paths.sdk_root,
    ])

    self.assertEqual(status, 0, 'the command should have succeeded.')

    # there should not be new files downloaded to sdk_root
    self.assertFalse(os.path.isfile(os.path.join(self.paths.gms_lib,
                                                 'dummy_file')))
    self.assertFalse(os.path.isfile(self.paths.gms_root_license))
コード例 #9
0
ファイル: update_test.py プロジェクト: bopopescu/proto-quic
  def testDownloadAlreadyUpToDate(self):
    self.SetUpWorkdir(
        populate_bucket=True,
        existing_zip_sha1=self.DEFAULT_ZIP_SHA1)

    status = update.main([
        'download',
        '--dry-run',
        '--bucket', self.paths.bucket,
        '--config', self.paths.config_file,
        '--sdk-root', self.paths.gms.sdk_root,
    ])

    self.assertEqual(status, 0, 'the command should have succeeded.')

    # there should not be new files downloaded to sdk_root
    self.assertFalse(os.path.isfile(os.path.join(self.paths.gms.client_paths[0],
                                                 'dummy_file')))
    self.assertFalse(os.path.isfile(self.paths.gms.license))
コード例 #10
0
  def testDownload(self):
    self.SetUpWorkdir(populate_bucket=True)

    with _MockedInput('y'):
      status = update.main([
          'download',
          '--dry-run',
          '--bucket', self.paths.bucket,
          '--config', self.paths.config_file,
          '--sdk-root', self.paths.gms.sdk_root,
      ])

    self.assertEqual(status, 0, 'the command should have succeeded.')

    # sdk_root should contain zip contents, zip sha1, license
    self.assertTrue(os.path.isfile(self.paths.gms.client_paths[0]))
    self.assertTrue(os.path.isfile(self.paths.gms.lib_zip_sha1))
    self.assertTrue(os.path.isfile(self.paths.gms.license))
    self.assertEquals(_GetFileContent(self.paths.gms.license),
                      self.DEFAULT_LICENSE)
コード例 #11
0
ファイル: update_test.py プロジェクト: bopopescu/proto-quic
  def testDownload(self):
    self.SetUpWorkdir(populate_bucket=True)

    with _MockedInput('y'):
      status = update.main([
          'download',
          '--dry-run',
          '--bucket', self.paths.bucket,
          '--config', self.paths.config_file,
          '--sdk-root', self.paths.gms.sdk_root,
      ])

    self.assertEqual(status, 0, 'the command should have succeeded.')

    # sdk_root should contain zip contents, zip sha1, license
    self.assertTrue(os.path.isfile(self.paths.gms.client_paths[0]))
    self.assertTrue(os.path.isfile(self.paths.gms.lib_zip_sha1))
    self.assertTrue(os.path.isfile(self.paths.gms.license))
    self.assertEquals(_GetFileContent(self.paths.gms.license),
                      self.DEFAULT_LICENSE)
コード例 #12
0
ファイル: update_test.py プロジェクト: 4con/hello-gn
  def testUploadAlreadyLatestVersion(self):
    self.SetUpWorkdir(
        xml_version=self.DEFAULT_CONFIG_VERSION,
        gms_lib=True,
        source_prop=True)

    status = update.main([
        'upload',
        '--dry-run',
        '--skip-git',
        '--bucket', self.paths.bucket,
        '--config', self.paths.config_file,
        '--sdk-root', self.paths.sdk_root,
    ])
    self.assertEqual(status, 0, 'the command should have succeeded.')

    # bucket should be empty
    self.assertFalse(os.listdir(self.paths.bucket))
    self.assertFalse(os.path.isfile(self.paths.config_license_sha1))
    self.assertFalse(os.path.isfile(self.paths.config_zip_sha1))
コード例 #13
0
ファイル: update_test.py プロジェクト: 4con/hello-gn
  def testDownloadRefusedLicense(self):
    self.SetUpWorkdir(
        populate_bucket=True,
        existing_license='Old license')

    with _MockedInput('n'):
      status = update.main([
          'download',
          '--dry-run',
          '--bucket', self.paths.bucket,
          '--config', self.paths.config_file,
          '--sdk-root', self.paths.sdk_root,
      ])

    self.assertEqual(status, 0, 'the command should have succeeded.')

    # there should not be new files downloaded to sdk_root
    self.assertFalse(os.path.isfile(os.path.join(self.paths.gms_lib,
                                                 'dummy_file')))
    self.assertEquals(_GetFileContent(self.paths.gms_root_license),
                      'Old license')
コード例 #14
0
ファイル: update_test.py プロジェクト: bopopescu/proto-quic
  def testDownloadRefusedLicense(self):
    self.SetUpWorkdir(
        populate_bucket=True,
        existing_license='Old license')

    with _MockedInput('n'):
      status = update.main([
          'download',
          '--dry-run',
          '--bucket', self.paths.bucket,
          '--config', self.paths.config_file,
          '--sdk-root', self.paths.gms.sdk_root,
      ])

    self.assertEqual(status, 0, 'the command should have succeeded.')

    # there should not be new files downloaded to sdk_root
    self.assertFalse(os.path.isfile(os.path.join(self.paths.gms.client_paths[0],
                                                 'dummy_file')))
    self.assertEquals(_GetFileContent(self.paths.gms.license),
                      'Old license')
コード例 #15
0
ファイル: update_test.py プロジェクト: 4con/hello-gn
  def testDownloadBot(self):
    self.SetUpWorkdir(populate_bucket=True, bot_env=True)

    # No need to type 'y' on bots
    status = update.main([
        'download',
        '--dry-run',
        '--bucket', self.paths.bucket,
        '--config', self.paths.config_file,
        '--sdk-root', self.paths.sdk_root,
    ])

    self.assertEqual(status, 0, 'the command should have succeeded.')

    # sdk_root should contain zip contents, zip sha1, license
    self.assertTrue(os.path.isfile(os.path.join(self.paths.gms_lib,
                                                'dummy_file')))
    self.assertTrue(os.path.isfile(self.paths.gms_root_sha1))
    self.assertTrue(os.path.isfile(self.paths.gms_root_license))
    self.assertEquals(_GetFileContent(self.paths.gms_root_license),
                      self.DEFAULT_LICENSE)
コード例 #16
0
    def testUploadAlreadyLatestVersion(self):
        self.SetUpWorkdir(xml_version=self.DEFAULT_CONFIG_VERSION,
                          gms_lib=True,
                          source_prop=True)

        status = update.main([
            'upload',
            '--dry-run',
            '--skip-git',
            '--bucket',
            self.paths.bucket,
            '--config',
            self.paths.config_file,
            '--sdk-root',
            self.paths.sdk_root,
        ])
        self.assertEqual(status, 0, 'the command should have succeeded.')

        # bucket should be empty
        self.assertFalse(os.listdir(self.paths.bucket))
        self.assertFalse(os.path.isfile(self.paths.config_license_sha1))
        self.assertFalse(os.path.isfile(self.paths.config_zip_sha1))
コード例 #17
0
  def testDownloadAcceptedLicense(self):
    self.SetUpWorkdir(
        populate_bucket=True,
        existing_license=self.DEFAULT_LICENSE)

    # License already accepted, no need to type
    status = update.main([
        'download',
        '--dry-run',
        '--bucket', self.paths.bucket,
        '--config', self.paths.config_file,
        '--sdk-root', self.paths.gms.sdk_root,
    ])

    self.assertEqual(status, 0, 'the command should have succeeded.')

    # sdk_root should contain zip contents, zip sha1, license
    self.assertTrue(os.path.isfile(self.paths.gms.client_paths[0]))
    self.assertTrue(os.path.isfile(self.paths.gms.lib_zip_sha1))
    self.assertTrue(os.path.isfile(self.paths.gms.license))
    self.assertEquals(_GetFileContent(self.paths.gms.license),
                      self.DEFAULT_LICENSE)
コード例 #18
0
ファイル: update_test.py プロジェクト: 4con/hello-gn
  def testDownloadNewLicense(self):
    self.SetUpWorkdir(
        populate_bucket=True,
        existing_license='Old license')

    with _MockedInput('y'):
      status = update.main([
          'download',
          '--dry-run',
          '--bucket', self.paths.bucket,
          '--config', self.paths.config_file,
          '--sdk-root', self.paths.sdk_root,
      ])

    self.assertEqual(status, 0, 'the command should have succeeded.')

    # sdk_root should contain zip contents, zip sha1, NEW license
    self.assertTrue(os.path.isfile(os.path.join(self.paths.gms_lib,
                                                'dummy_file')))
    self.assertTrue(os.path.isfile(self.paths.gms_root_sha1))
    self.assertTrue(os.path.isfile(self.paths.gms_root_license))
    self.assertEquals(_GetFileContent(self.paths.gms_root_license),
                      self.DEFAULT_LICENSE)