示例#1
0
    def test_006_push_sdp_data_into_server(self):
	for key in ['server', 'hash_id', 'password']:
	    self.assertTrue('agent2_%s' % key in environ)
    	    methods.setSetting(key, environ['agent2_%s' % key])

	camp1 = op_models.MarketingCampaign(service=0, enabled=False)
	camp2 = op_models.MarketingCampaign(service=1, enabled=False)
	camp1.save()
	camp2.save()

	amount_records=randrange(10,30)
	self.__generate_sdp_records(amount_records)

	camp1.enabled=True
	camp1.save()
	self.__generate_sdp_records(amount_records)

	camp2.enabled=True
	camp2.save()
	self.__generate_sdp_records(amount_records)


	pks=methods.getLockOverRecords(models.uploadSDPRecord)
	records = methods.getRecordsForUpload(models.uploadSDPRecord, pks)
        remotes = methods.getRemotesForUpload(models.uploadSDPRecord, pks)

	self.assertEqual(amount_records*3, 
	    methods.pushRecords(models.uploadSDPRecord, records, remotes))
	op_models.MarketingCampaign.objects.filter(pk__in=[camp1.pk, camp2.pk]).delete()
示例#2
0
    def test_004_push_scan_data_into_server(self):
	for key in ['server', 'hash_id', 'password']:
	    self.assertTrue('agent2_%s' % key in environ)
    	    methods.setSetting(key, environ['agent2_%s' % key])

	amount_records=randrange(10,30)
	self.__generate_found_records(amount_records)

	pks=methods.getLockOverRecords(models.uploadFoundRecord)
	records = methods.getRecordsForUpload(models.uploadFoundRecord, pks)
        remotes = methods.getRemotesForUpload(models.uploadFoundRecord, pks)
        
	self.assertEqual(amount_records, 
		methods.pushRecords(models.uploadFoundRecord, records, remotes)
	)