def test_device_smoke_test(self): device = Device() device.unique_identifier = 'test_device_smoke_test' device.owner = self.default_user device.current_build = self.default_build device.platform = self.default_platform device.save()
def test_device_retrieval(self): device = Device() device.operating_system = 'test_device_retrieval_os' device.unique_identifier = 'test_device_retrieval' device.owner = self.default_user device.current_build = self.default_build device.platform = self.default_platform device.save() new_device = Device.from_auth_token(device.auth_token) self.assertEquals(new_device.operating_system, device.operating_system) new_device = Device.from_verification_code(device.verification_code) self.assertEquals(new_device.operating_system, device.operating_system)
def test_device_owner_relation(self): user = User() user.email = 'tesdevicerelations@localhost' user.save() device = Device() device.unique_identifier = 'test_device_relations' device.owner = user device.current_build = self.default_build device.platform = self.default_platform device.save() device = Device.from_unique_identifier(device.unique_identifier) self.assertEquals(device.owner.email, user.email)
def test_device_attributes(self): device = Device() device.unique_identifier = 'test_device_attributes' device.model = 'test_device_attributes_model' device.operating_system = 'test_device_attributes_os_version' device.additional_info = 'test_device_attributes_additional_info' device.owner = self.default_user device.current_build = self.default_build device.platform = self.default_platform device.save() new_device = Device.from_unique_identifier(device.unique_identifier) self.assertEquals(new_device.model, device.model) self.assertEquals(new_device.operating_system, device.operating_system) self.assertEquals(new_device.additional_info, device.additional_info)
def populate(): for obj in Device.all() + User.all() + Build.all() + Platform.all() + Carrier.all(): obj.destroy() carrier = Carrier() carrier.name = 'AT&T' carrier.identifier = 'att' carrier.save() platform = Platform() platform.name = 'Android' platform.identifier = 'android' platform.owner_email = 'android@localhost' platform.save() platform = Platform() platform.name = 'Windows Phone 7' platform.identifier = 'wp7' platform.owner_email = 'wp7@localhost' platform.save() platform = Platform() platform.name = 'iOS' platform.identifier = 'ios' platform.owner_email = 'ios@localhost' platform.save() build = Build() build.build_number = '1.0' build.platform = platform build.classification = 'official' build.save() beta_build = Build() beta_build.build_number = '1.1beta' beta_build.platform = platform beta_build.classification = 'beta' beta_build.save() user = User() user.name = 'User 1' user.email = 'user1@localhost' user.save() device = Device() device.owner = user device.unique_identifier = str(uuid4()) device.current_build = build device.carrier = carrier device.platform = platform device.save() for i in range(20): build = Build() build.build_number = '1.1.' + str(i) + 'dev' build.platform = platform build.classification = 'rolling' build.save() for i in range(100): device = Device() device.owner = user device.unique_identifier = str(uuid4()) device.current_build = beta_build device.carrier = carrier device.platform = platform device.save() for i in range(100): user = User() user.email = str(uuid4()) + '@localhost' user.save() device = Device() device.owner = user device.unique_identifier = str(uuid4()) device.current_build = beta_build device.carrier = carrier device.platform = platform device.save()