| |
501 |
|
| |
502 |
Test("Both users change the same field")
|
| |
503 |
UseDB(copya)
|
| |
504 |
|
| |
505 |
print '---- Changed name in first database'
|
| |
506 |
tname = 'Resource'
|
| |
507 |
change = {'Table': tname, 'ID':1, 'Name': 'Alice', 'zzStatus': 'deleted'}
|
| |
508 |
Data.Update(change)
|
| |
509 |
Data.SetUndo('Changed name')
|
| |
510 |
ShareMod.DoCall()
|
| |
511 |
|
| |
512 |
UseDB(copyb)
|
| |
513 |
|
| |
514 |
print '---- Adding assignment data to second database'
|
| |
515 |
tname = 'Resource'
|
| |
516 |
change = {'Table': tname, 'ID':1, 'Name': 'Bob'}
|
| |
517 |
Data.Update(change)
|
| |
518 |
Data.SetUndo('Changed name')
|
| |
519 |
ShareMod.DoCall()
|
| |
520 |
|
| |
521 |
UseDB(copya)
|
| |
522 |
|
| |
523 |
ShareMod.DoCall() # make sure we have all of the changes
|
| |
524 |
print '---- Verifing results in first database'
|
| |
525 |
tname = 'Resource'
|
| |
526 |
print 'checking %s' % tname
|
| |
527 |
table = Data.Database[tname]
|
| |
528 |
row = Data.Database['Resource'][1]
|
| |
529 |
expected_row = {'ID': 1, 'Name': 'Alice', 'zzStatus': 'deleted'}
|
| |
530 |
compare_dicts(expected_row, row)
|
| |
531 |
|
| |
532 |
UseDB(copyb)
|
| |
533 |
|
| |
534 |
ShareMod.DoCall() # make sure we have all of the changes
|
| |
535 |
print '---- Verifing results in second database'
|
| |
536 |
tname = 'Resource'
|
| |
537 |
print 'checking %s' % tname
|
| |
538 |
table = Data.Database[tname]
|
| |
539 |
row = Data.Database['Resource'][1]
|
| |
540 |
expected_row = {'ID': 1, 'Name': 'Alice', '__Name': 'Bob', 'zzStatus': 'deleted'}
|
| |
541 |
compare_dicts(expected_row, row)
|
| |
542 |
|
| |
543 |
Result('') # end of test
|
| |
544 |
|
| |
545 |
|
| |
546 |
Test("Both users add the same report type field")
|
| |
547 |
UseDB(copya)
|
| |
548 |
|
| |
549 |
print '---- Add report type in first database'
|
| |
550 |
rt = { 'Name': 'Widget', 'TableA': 'Widget', 'AllOrEach': 'both',
|
| |
551 |
'SuggestedColumns': ',ID;,Name;,Date;,Color' }
|
| |
552 |
ct = [
|
| |
553 |
{ 'Name': 'ID', 'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': False },
|
| |
554 |
{ 'Name': 'Name', 'Label': 'Name', 'DataType': 't', 'AccessType': 'd', 'T': 'A', 'Edit': True, 'Width': 140 },
|
| |
555 |
{ 'Name': 'Date', 'Label': 'Date', 'DataType': 'd', 'AccessType': 'd', 'T': 'A', 'Edit': True, 'Width': 80 },
|
| |
556 |
{ 'Name': 'Color', 'Label': 'Owner', 'DataType': 't', 'AccessType': 'd', 'T': 'A', 'Edit': True, 'Width': 140 },
|
| |
557 |
]
|
| |
558 |
Data.AddReportType(rt, ct)
|
| |
559 |
Data.SetUndo("Install Widget Tracking")
|
| |
560 |
ShareMod.DoCall()
|
| |
561 |
|
| |
562 |
UseDB(copyb)
|
| |
563 |
|
| |
564 |
print '---- Adding assignment data to second database'
|
| |
565 |
rt = { 'Name': 'Widget', 'TableA': 'Widget', 'AllOrEach': 'both',
|
| |
566 |
'SuggestedColumns': ',ID;,Name;,Date;,Weight' }
|
| |
567 |
ct = [
|
| |
568 |
{ 'Name': 'ID', 'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': False },
|
| |
569 |
{ 'Name': 'Name', 'Label': 'Name', 'DataType': 't', 'AccessType': 'd', 'T': 'A', 'Edit': True, 'Width': 140 },
|
| |
570 |
{ 'Name': 'Date', 'Label': 'Date', 'DataType': 'd', 'AccessType': 'd', 'T': 'A', 'Edit': True, 'Width': 80 },
|
| |
571 |
{ 'Name': 'Weight', 'Label': 'Owner', 'DataType': 't', 'AccessType': 'd', 'T': 'A', 'Edit': True, 'Width': 140 },
|
| |
572 |
]
|
| |
573 |
Data.AddReportType(rt, ct)
|
| |
574 |
Data.SetUndo("Install Widget Tracking")
|
| |
575 |
ShareMod.DoCall()
|
| |
576 |
|
| |
577 |
UseDB(copya)
|
| |
578 |
|
| |
579 |
def VerifyReportType():
|
| |
580 |
tname = 'ReportType'
|
| |
581 |
print 'checking %s' % tname
|
| |
582 |
table = Data.Database[tname]
|
| |
583 |
results = Data.SearchByColumn(table, {'Name': 'Widget'})
|
| |
584 |
compare_values('matching widget report type count', 1, len(results))
|
| |
585 |
report_type_id = results.keys()[0]
|
| |
586 |
tname = 'ColumnType'
|
| |
587 |
print 'checking %s' % tname
|
| |
588 |
table = Data.Database[tname]
|
| |
589 |
results = Data.SearchByColumn(table, {'ReportTypeID': report_type_id})
|
| |
590 |
compare_values('matching widget column type count', 5, len(results))
|
| |
591 |
|
| |
592 |
ShareMod.DoCall() # make sure we have all of the changes
|
| |
593 |
print '---- Verifing results in first database'
|
| |
594 |
VerifyReportType()
|
| |
595 |
|
| |
596 |
UseDB(copyb)
|
| |
597 |
|
| |
598 |
ShareMod.DoCall() # make sure we have all of the changes
|
| |
599 |
print '---- Verifing results in second database'
|
| |
600 |
VerifyReportType()
|
| |
601 |
|
| |
602 |
Result('') # end of test
|
| |
603 |
|
| |
604 |
|
| |
605 |
Test("Both users add a column to same report in same place")
|
| |
606 |
UseDB(copya)
|
| |
607 |
|
| |
608 |
def AddColumn(colname):
|
| |
609 |
table = Data.Database['ReportType']
|
| |
610 |
results = Data.SearchByColumn(table, {'Name': 'Task'})
|
| |
611 |
report_type_id = results.keys()[0]
|
| |
612 |
table = Data.Database['ColumnType']
|
| |
613 |
results = Data.SearchByColumn(table, {'Name': colname, 'ReportTypeID': report_type_id})
|
| |
614 |
column_type_id = results.keys()[0]
|
| |
615 |
|
| |
616 |
report_row = Data.Database['Report'][4]
|
| |
617 |
old_first_column = report_row['FirstColumn']
|
| |
618 |
change = {'Table': 'ReportColumn', 'ReportID': 4, 'ColumnTypeID': column_type_id, 'NextColumn': old_first_column}
|
| |
619 |
new_column_id = Data.Update(change)['ID']
|
| |
620 |
change = {'Table': 'Report', 'ID': 4, 'FirstColumn': new_column_id}
|
| |
621 |
Data.Update(change)
|
| |
622 |
|
| |
623 |
def VerifyColumns():
|
| |
624 |
cols = Data.GetColumnList(4)
|
| |
625 |
first_col = Data.Database['ReportColumn'][cols[0]]
|
| |
626 |
first_name = Data.Database['ColumnType'][first_col['ColumnTypeID']]['Name']
|
| |
627 |
compare_values('matching first column type name', 'Project/Name', first_name)
|
| |
628 |
|
| |
629 |
last_col = Data.Database['ReportColumn'][cols[-1]]
|
| |
630 |
last_name = Data.Database['ColumnType'][last_col['ColumnTypeID']]['Name']
|
| |
631 |
compare_values('matching last column type name', 'ID', last_name)
|
| |
632 |
|
| |
633 |
print '---- Add column in first database'
|
| |
634 |
AddColumn('ID')
|
| |
635 |
Data.SetUndo("Add Column")
|
| |
636 |
ShareMod.DoCall()
|
| |
637 |
|
| |
638 |
UseDB(copyb)
|
| |
639 |
|
| |
640 |
print '---- Add column in second database'
|
| |
641 |
AddColumn('Project/Name')
|
| |
642 |
Data.SetUndo("Add Column")
|
| |
643 |
ShareMod.DoCall()
|
| |
644 |
|
| |
645 |
UseDB(copya)
|
| |
646 |
|
| |
647 |
|
| |
648 |
ShareMod.DoCall() # make sure we have all of the changes
|
| |
649 |
print '---- Verifing results in first database'
|
| |
650 |
VerifyColumns()
|
| |
651 |
|
| |
652 |
UseDB(copyb)
|
| |
653 |
|
| |
654 |
ShareMod.DoCall() # make sure we have all of the changes
|
| |
655 |
print '---- Verifing results in second database'
|
| |
656 |
VerifyColumns()
|
| |
657 |
|
| |
658 |
Result('') # end of test
|
| |
659 |
|
| |
660 |
print "\n----\nOverall Results: passed %d tests out of %d\n----\n" % (pass_count, total_count)
|