def setUpClass(cls): cls.no_permission, cls.post, cls.post_modify, cls.post_modify_delete = test_utils.create_test_users( Machine) Site(name='site1').save() cls.site1 = Site.objects.get(name='site1') Department(name='department1', site=cls.site1).save() Department(name='department2', site=cls.site1).save() cls.department1 = Department.objects.get(name='department1') cls.department2 = Department.objects.get(name='department2') Machine(department=cls.department1, created=dt.now(), modified=dt.now(), name='Machine1').save() Machine(department=cls.department2, created=dt.now(), modified=dt.now(), name='Machine2').save() cls.update_id = Machine.objects.get(name='Machine1').id cls.delete_id = Machine.objects.get(name='Machine2').id cls.Machine = { 'department': cls.department1.id, 'created': test_utils.get_timestamp(days=1), 'modified': test_utils.get_timestamp(), 'name': 'Machine3' }
def setUpClass(cls): Site(name='site4').save() cls.site1 = Site.objects.get(name='site4') Department(name='department3', site=cls.site1).save() cls.department1 = Department.objects.get(name='department3') cls.Machine = { 'created': test_utils.get_timestamp(days=1), 'modified': test_utils.get_timestamp(), 'name': 'Machine3', 'department': cls.department1.id } cls.Machine_malformed = { 'created': 'bad', 'modified': 'bad', 'department': 'bad', 'name': 1 } cls.Machine_blank = { 'created': '', 'modified': '', 'department': '', 'name': '' } cls.Machine_missing = {} cls.malformed_checks = ['created', 'modified'] cls.blank_checks = ['created', 'modified', 'name'] cls.missing_checks = ['name']
def setUpClass(cls): cls.no_permission, cls.post, cls.post_modify, cls.post_modify_delete = test_utils.create_test_users( Position) Site(name='site1').save() cls.site1 = Site.objects.get(name='site1') Department(name='department1', site=cls.site1).save() Department(name='department2', site=cls.site1).save() cls.department1 = Department.objects.get(name='department1') cls.department2 = Department.objects.get(name='department2') Position(department=cls.department1, created=dt.now(), modified=dt.now(), label='Position1').save() Position(department=cls.department2, created=dt.now(), modified=dt.now(), label='Position2').save() cls.update_id = Position.objects.get(label='Position1').id cls.delete_id = Position.objects.get(label='Position2').id cls.Position = { 'site': cls.site1.id, 'created': test_utils.get_timestamp(days=1), 'modified': test_utils.get_timestamp(), 'label': 'Position3' }
def setUpClass(cls): cls.no_permission, cls.post, cls.post_modify, cls.post_modify_delete = test_utils.create_test_users(Site) Site(created=dt.now(), modified=dt.now(), name='site1', code='code1', location='loc1', active=True, directory='dir1').save() Site(created=dt.now(), modified=dt.now(), name='site2', code='code2', location='loc2', active=False, directory='dir2').save() cls.update_id = Site.objects.get(name='site1').id cls.delete_id = Site.objects.get(name='site2').id cls.site = {'created': test_utils.get_timestamp(days=1), 'modified': test_utils.get_timestamp(), 'name': 'site3', 'code': 'code3', 'location': 'loc3', 'active': True, 'directory': 'dir3'}
def setUpClass(cls): cls.site = {'created': test_utils.get_timestamp(days=1), 'modified': test_utils.get_timestamp(), 'name': 'site3', 'code': 'code3', 'location': 'loc3', 'active': True, 'directory': 'dir3'} cls.site_malformed = {'created': 'bad', 'modified': 'bad', 'name': 'site3', 'code': 'code3', 'location': 'loc3', 'active': 'bad', 'directory': 'dir3'} cls.site_blank = {'created': '', 'modified': '', 'name': '', 'code': '', 'location': '', 'active': '', 'directory': ''} cls.site_missing = {} cls.malformed_checks = ['created', 'modified', 'active'] cls.blank_checks = ['name', 'code', 'created', 'modified', 'active'] cls.missing_checks = ['name', 'code']
def setUpClass(cls): cls.datapoint = { 'timestamp': test_utils.get_timestamp(), 'machine': 'mch3', 'userName': '******', 'description': 'desc3', 'oldValue': 15, 'newValue': 10 } cls.datapoint_malformed = { 'timestamp': 'test', 'machine': 'mch3', 'userName': '******', 'description': 'nope', 'oldValue': 15, 'newValue': 10 } cls.datapoint_blank = { 'timestamp': '', 'machine': '', 'userName': '', 'description': '', 'oldValue': '', 'newValue': '' } cls.datapoint_missing = {} cls.malformed_checks = ['timestamp'] cls.blank_checks = ['oldValue', 'newValue', 'timestamp'] cls.missing_checks = ['oldValue', 'newValue', 'timestamp']
def setUpClass(cls): cls.no_permission, cls.post, cls.post_modify, cls.post_modify_delete = test_utils.create_test_users( ProcessLog) cls.site = Site.objects.create(name='test1') cls.department = Department.objects.create(name='testd1', site=cls.site) cls.machine = Machine.objects.create(name='testm1', department=cls.department) cls.update = ProcessLog.objects.create(timestamp=dt.now(), machine=cls.machine, userName='******', description='desc1', oldValue='3', newValue='1') cls.delete = ProcessLog.objects.create(timestamp=dt.now(), machine=cls.machine, userName='******', description='desc2', oldValue='4', newValue='2') cls.datapoint = { 'timestamp': test_utils.get_timestamp(), 'machine': cls.machine.id, 'userName': '******', 'description': 'desc3', 'oldValue': 15, 'newValue': 10 } cls.datapoint_malformed = { 'timestamp': 'test', 'machine': cls.machine.id, 'userName': '******', 'description': '', 'oldValue': 15, 'newValue': 10 } cls.datapoint_blank = { 'timestamp': '', 'machine': '', 'userName': '', 'description': '', 'oldValue': '', 'newValue': '' } cls.datapoint_missing = {}