def _EscrowPassphrase(self, passphrase):
   fvv = firmware.AppleFirmwarePassword(
       serial=self.serial,
       password=passphrase,
       hostname='somehost.local',
       platform_uuid=self.platform_uuid,
       created_by=users.User('*****@*****.**'))
   return fvv.put()
예제 #2
0
  def testAppleFirmwareSearch(self):
    firmware.AppleFirmwarePassword(
        owner='stub7', serial='stub', created_by=users.User('*****@*****.**'),
        password=str(uuid.uuid4()), platform_uuid='stub', hostname='host1'
    ).put()

    resp = self.testapp.get(
        '/search?search_type=apple_firmware&field1=owner&value1=stub7&json=1')
    self.assertEqual(1, len(util.FromSafeJson(resp.body)['passphrases']))
예제 #3
0
    def _CreateNewSecretEntity(self, owner, target_id, secret):
        entity = firmware.AppleFirmwarePassword(owner=owner,
                                                serial=target_id,
                                                password=str(secret))

        inventory = service_factory.GetInventoryService()
        entity.asset_tags = inventory.GetAssetTagsFromUploadRequest(
            entity, self.request)

        return entity
  def testRetrieval(self):
    password = '******'
    hostname = 'host1'
    serial = 'SERIAL'
    firmware.AppleFirmwarePassword(
        serial=serial, hostname=hostname, password=password, owners=['stub7'],
        platform_uuid='ID1',
    ).put()

    resp = util.FromSafeJson(
        self.testapp.get('/apple_firmware/SERIAL', status=httplib.OK).body)

    self.assertEqual(password, resp['passphrase'])
    self.assertEqual(serial, resp['volume_uuid'])
예제 #5
0
def MakeAppleFirmware(save=True, **kwargs):
    """Create and return a AppleFirmware for test."""
    defaults = {
        'serial': 'blah',
        'password': '******',
        'platform_uuid': str(uuid.uuid4()).upper(),
        'owner': 'someone',
        'asset_tags': ['12345'],
        'hostname': 'zerocool.example.com',
    }
    defaults.update(kwargs)

    entity = firmware.AppleFirmwarePassword(**defaults)
    if save:
        entity.put()
    return entity
예제 #6
0
 def _CreateNewSecretEntity(self, owner, target_id, secret):
   return firmware.AppleFirmwarePassword(
       owner=owner,
       serial=target_id,
       password=str(secret))