1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-05 02:29:26 +02:00

Update to new device DB.

This commit is contained in:
Simo Kinnunen 2014-06-18 22:51:39 +09:00
parent 760e09290f
commit b9484019a3
8 changed files with 32 additions and 53 deletions

View file

@ -4,9 +4,9 @@ var uuid = require('node-uuid')
var _ = require('lodash')
var dbapi = require('../db/api')
var devices = require('stf-device-db')
var devices = require('stf-device-db/dist/devices-latest')
module.exports.generate = function() {
module.exports.generate = function(wantedModel) {
var serial = util.format(
'fake-%s'
, uuid.v4(null, new Buffer(16)).toString('base64')
@ -20,11 +20,12 @@ module.exports.generate = function() {
, status: 'OFFLINE'
})
.then(function() {
var model = wantedModel || _.sample(Object.keys(devices))
return dbapi.saveDeviceIdentity(serial, {
platform: 'Android'
, manufacturer: 'Foo Electronics'
, operator: 'Loss Networks'
, model: _.sample(Object.keys(devices))
, model: model
, version: '4.1.2'
, abi: 'armeabi-v7a'
, sdk: 8 + Math.floor(Math.random() * 12)
@ -46,6 +47,7 @@ module.exports.generate = function() {
, network: 'LTE'
, phoneNumber: '0000000000'
}
, product: model
})
})
.then(function() {