Example #1
0
    def test_b_owner_details(self):
        kennel = controller.setup()

        owner = kennel.all_my_owners[0]
        assert owner.id == 'BMC'
        assert owner.first_name == 'Brad'
        assert owner.last_name == 'McCaw'
        assert owner.birth_date == date(1982, 11, 12)

        owner = kennel.all_my_owners[1]
        assert owner.id == 'RTH'
        assert owner.first_name == 'Richie'
        assert owner.last_name == 'Thorn'
        assert owner.birth_date == date(1980, 4, 8)

        owner = kennel.all_my_owners[2]
        assert owner.id == 'DEL'
        assert owner.first_name == 'Dan'
        assert owner.last_name == 'Ellis'
        assert owner.birth_date == date(1984, 1, 16)

        owner = kennel.all_my_owners[3]
        assert owner.id == 'ACR'
        assert owner.first_name == 'Andrew'
        assert owner.last_name == 'Carter'
        assert owner.birth_date == date(1987, 10, 30)
Example #2
0
    def test_b_member_details(self):
        club = controller.setup()
        member = club.all_my_members[0]
        assert member.id == 'M02'
        assert member.first_name == 'Mary'
        assert member.last_name == 'Shelly'
        assert member.birth_date == date(1981, 1, 17)

        member = club.all_my_members[1]
        assert member.id == 'M04'
        assert member.first_name == 'Melvin'
        assert member.last_name == 'Dean'
        assert member.birth_date == date(2000, 8, 8)

        member = club.all_my_members[2]
        assert member.id == 'M05'
        assert member.first_name == 'Jim'
        assert member.last_name == 'Beam'
        assert member.birth_date == date(1980, 12, 27)

        member = club.all_my_members[3]
        assert member.id == 'M01'
        assert member.first_name == 'Carla'
        assert member.last_name == 'Main'
        assert member.birth_date == date(1980, 7, 11)

        member = club.all_my_members[4]
        assert member.id == 'M03'
        assert member.first_name == 'James'
        assert member.last_name == 'Bean'
        assert member.birth_date == date(2001, 8, 15)
 def test_f_display_pools_team_format(self):
     the_rwc = controller.setup()
     returned = the_rwc.display_teams_pools()
     self.assertEqual(
         returned,
         "A\nIreland\nScotland\nJapan\nRussia\nSamoa\nB\nNew Zealand\nSouth Africa\nItaly\nNamibia\nCanada\nC\nEngland\nFrance\nArgentina\nUnited States\nTonga\nD\nAustralia\nWales\nGeorgia\nFiji\nUruguay\n"
     )
Example #4
0
def setup():
    player = get_player_prereqs()

    result = controller.setup(player, int(request.args["settlement"]), int(request.args["roadto"]))

    flush_log(player.GameID)
    return JsonResponse(result)
 def test_xxx_blood_bank_display_positive_donations_details(self):
     blood_bank = controller.setup()
     returned = blood_bank.display_positive_donations()
     assert returned == 'Moore, Sandy [F]\n\thas blood group <AB+> donated on 2018-11-01 at Christchurch\nWatson, ' \
                        'Cathy [F]\n\thas blood group <O+> donated on 2019-06-15 at Auckland\nWatts, ' \
                        'Jonathan [M]\n\thas blood group <AB+> donated on 2017-10-09 at Nelson\n\thas blood group ' \
                        '<AB+> donated on 2018-09-05 at Otago\n'
 def test_g_display_matches_date_format(self):
     the_rwc = controller.setup()
     returned = the_rwc.display_matches_date()
     self.assertEqual(
         returned,
         "2019-09-20 00:00:00 Japan Russia Tokyo Stadium, Chofu A\n2019-09-21 00:00:00 New Zealand South Africa International Stadium Yokohama, Yokohama B\n2019-09-21 00:00:00 France Argentina Tokyo Stadium, Chofu C\n2019-09-21 00:00:00 Australia Fiji Sapporo Dome, Sapporo D\n2019-09-22 00:00:00 Ireland Scotland International Stadium Yokohama, Yokohama A\n2019-09-22 00:00:00 Italy Namibia Hanazono Rugby Stadium, Higashiosaka B\n2019-09-22 00:00:00 England Tonga Sapporo Dome, Sapporo C\n2019-09-23 00:00:00 Wales Georgia City of Toyota Stadium, Toyota D\n2019-09-24 00:00:00 Russia Samoa Kumagaya Rugby Stadium, Kumagaya A\n2019-09-25 00:00:00 Fiji Uruguay Kamaishi Recovery Memorial Stadium, Kamaishi D\n2019-09-26 00:00:00 Italy Canada Fukuoka Hakatanomori Stadium, Fukuoka B\n2019-09-26 00:00:00 England United States Kobe Misaki Stadium, Kobe C\n2019-09-28 00:00:00 Japan Ireland Shizuoka Stadium Ecopa, Fukuroi A\n2019-09-28 00:00:00 South Africa Namibia City of Toyota Stadium, Toyota B\n2019-09-28 00:00:00 Argentina Tonga Hanazono Rugby Stadium, Higashiosaka C\n2019-09-29 00:00:00 Georgia Uruguay Kumagaya Rugby Stadium, Kumagaya D\n2019-09-29 00:00:00 Australia Wales Tokyo Stadium, Chofu D\n2019-09-30 00:00:00 Scotland Samoa Kobe Misaki Stadium, Kobe A\n2019-10-02 00:00:00 New Zealand Canada Oita Stadium, Oita B\n2019-10-02 00:00:00 France United States Fukuoka Hakatanomori Stadium, Fukuoka C\n2019-10-03 00:00:00 Ireland Russia Kobe Misaki Stadium, Kobe A\n2019-10-03 00:00:00 Georgia Fiji Hanazono Rugby Stadium, Higashiosaka D\n2019-10-04 00:00:00 South Africa Italy Shizuoka Stadium Ecopa, Fukuroi B\n2019-10-05 00:00:00 Japan Samoa City of Toyota Stadium, Toyota A\n2019-10-05 00:00:00 England Argentina Tokyo Stadium, Chofu C\n2019-10-05 00:00:00 Australia Uruguay Oita Stadium, Oita D\n2019-10-06 00:00:00 New Zealand Namibia Tokyo Stadium, Chofu B\n2019-10-06 00:00:00 France Tonga Kumamoto Stadium, Kumamoto C\n2019-10-08 00:00:00 South Africa Canada Kobe Misaki Stadium, Kobe B\n2019-10-09 00:00:00 Scotland Russia Shizuoka Stadium Ecopa, Fukuroi A\n2019-10-09 00:00:00 Argentina United States Kumagaya Rugby Stadium, Kumagaya C\n2019-10-09 00:00:00 Wales Fiji Oita Stadium, Oita D\n2019-10-11 00:00:00 Australia Georgia Shizuoka Stadium Ecopa, Fukuroi D\n2019-10-12 00:00:00 Ireland Samoa Fukuoka Hakatanomori Stadium, Fukuoka A\n2019-10-12 00:00:00 New Zealand Italy City of Toyota Stadium, Toyota B\n2019-10-12 00:00:00 England France International Stadium Yokohama, Yokohama C\n2019-10-13 00:00:00 Japan Scotland International Stadium Yokohama, Yokohama A\n2019-10-13 00:00:00 Namibia Canada Kamaishi Recovery Memorial Stadium, Kamaishi B\n2019-10-13 00:00:00 United States Tonga Hanazono Rugby Stadium, Higashiosaka C\n2019-10-13 00:00:00 Wales Uruguay Kumamoto Stadium, Kumamoto D\n"
     )
Example #7
0
    def test_b_owner_details(self):
        cattery = controller.setup()
        owner = cattery.all_my_owners[0]
        assert owner.id == '7'
        assert owner.first_name == 'Ruth'
        assert owner.last_name == 'George'
        assert owner.amount_owed == 12.34

        owner = cattery.all_my_owners[1]
        assert owner.id == '23'
        assert owner.first_name == 'Casey'
        assert owner.last_name == 'van Dyke'
        assert owner.amount_owed == 34.56

        owner = cattery.all_my_owners[2]
        assert owner.id == '4'
        assert owner.first_name == 'Temepara'
        assert owner.last_name == 'Williams'
        assert owner.amount_owed == 12.56

        owner = cattery.all_my_owners[3]
        assert owner.id == '165'
        assert owner.first_name == 'Irene'
        assert owner.last_name == 'Aitkin'
        assert owner.amount_owed == 56.12
Example #8
0
    def test_b_correct_donor_details(self):
        blood_bank = controller.setup()

        donor = blood_bank.all_my_donors[0]
        assert donor.id == 9800100
        assert donor.first_name == 'Jonathan'
        assert donor.last_name == 'Watts'
        assert donor.gender == 'M'

        donor = blood_bank.all_my_donors[1]
        assert donor.id == 4023500
        assert donor.first_name == 'Sandy'
        assert donor.last_name == 'Moore'
        assert donor.gender == 'F'

        donor = blood_bank.all_my_donors[2]
        assert donor.id == 7906553
        assert donor.first_name == 'John'
        assert donor.last_name == 'Burk'
        assert donor.gender == 'M'

        donor = blood_bank.all_my_donors[3]
        assert donor.id == 5000990
        assert donor.first_name == 'Daniel'
        assert donor.last_name == 'McDonald'
        assert donor.gender == 'M'

        donor = blood_bank.all_my_donors[4]
        assert donor.id == 6896701
        assert donor.first_name == 'Cathy'
        assert donor.last_name == 'Watson'
        assert donor.gender == 'F'
    def test_a_members_have_correct_activity_number(self):
        club = controller.setup()

        memberM01 = club.find_member('M01')
        assert len(memberM01.all_my_activities) == 1

        memberM05 = club.find_member('M05')
        assert len(memberM05.all_my_activities) == 3

        memberM02 = club.find_member('M02')
        assert len(memberM02.all_my_activities) == 1

        memberM04 = club.find_member('M04')
        assert len(memberM04.all_my_activities) == 1
Example #10
0
    def test_h_owners_have_correct_cat_numbers(self):
        cattery = controller.setup()

        owner4 = cattery.find_owner('4')
        assert len(owner4.all_my_cats) == 1

        owner7 = cattery.find_owner('7')
        assert len(owner7.all_my_cats) == 1

        owner23 = cattery.find_owner('23')
        assert len(owner23.all_my_cats) == 3

        owner165 = cattery.find_owner('165')
        assert len(owner165.all_my_cats) == 1
Example #11
0
    def test_h_owners_have_correct_dog_numbers(self):
        kennel = controller.setup()

        ownerBMC = kennel.find_owner('BMC')
        assert len(ownerBMC.all_my_dogs) == 1

        ownerRTH = kennel.find_owner('RTH')
        assert len(ownerRTH.all_my_dogs) == 2

        ownerDEL = kennel.find_owner('DEL')
        assert len(ownerDEL.all_my_dogs) == 2

        ownerARC = kennel.find_owner('ACR')
        assert len(ownerARC.all_my_dogs) == 1
Example #12
0
    def test_i_cat_details(self):
        cattery = controller.setup()

        owner4 = cattery.find_owner('4')
        aCat = owner4.all_my_cats[0]
        assert aCat.my_owner, owner4
        assert aCat.name == 'Meta'
        assert aCat.secret_name == 'Mouse\'s worse nightmare'
        assert aCat.breed == 'Tabby'
        assert aCat.gender == 'F'

        owner7 = cattery.find_owner('7')
        aCat = owner7.all_my_cats[0]
        assert aCat.my_owner, owner7
        assert aCat.name == 'Art'
        assert aCat.secret_name == 'The Underwear Thief'
        assert aCat.breed == 'Abyssianian'
        assert aCat.gender == 'N'

        owner23 = cattery.find_owner('23')

        aCat = owner23.all_my_cats[0]
        assert aCat.my_owner, owner23
        assert aCat.name == 'Fluffy'
        assert aCat.secret_name == 'Grey ghost'
        assert aCat.breed == 'Persian'
        assert aCat.gender == 'M'

        aCat = owner23.all_my_cats[1]
        assert aCat.my_owner, owner23
        assert aCat.name == 'Blackey'
        assert aCat.secret_name == 'Her Majesty'
        assert aCat.breed == 'Common Domestic'
        assert aCat.gender == 'N'

        aCat = owner23.all_my_cats[2]
        assert aCat.my_owner, owner23
        assert aCat.name == 'Inky'
        assert aCat.secret_name == 'The Talker'
        assert aCat.breed == 'Persian'
        assert aCat.gender == 'F'

        owner165 = cattery.find_owner('165')
        aCat = owner165.all_my_cats[0]
        assert aCat.my_owner, owner165
        assert aCat.name == 'Random'
        assert aCat.secret_name == 'The One-Eyed Horror'
        assert aCat.breed == 'Siamese'
        assert aCat.gender == 'F'
Example #13
0
    def test_i_dog_details(self):
        kennel = controller.setup()

        ownerBMC = kennel.find_owner('BMC')
        aDog = ownerBMC.all_my_dogs[0]
        assert aDog.my_owner, ownerBMC
        assert aDog.name == 'Speedy'
        assert aDog.favorite_food == 'Ekanuba'
        assert aDog.breed == 'Pomeranian'
        assert aDog.gender == 'N'

        ownerRTH = kennel.find_owner('RTH')
        aDog = ownerRTH.all_my_dogs[0]
        assert aDog.my_owner, ownerRTH
        assert aDog.name == 'Victor'
        assert aDog.favorite_food == 'Chef'
        assert aDog.breed == 'Beagle'
        assert aDog.gender == 'M'
        aDog = ownerRTH.all_my_dogs[1]
        assert aDog.my_owner, ownerRTH
        assert aDog.name == 'Killer'
        assert aDog.favorite_food == 'Purina'
        assert aDog.breed == 'Mastiff'
        assert aDog.gender == 'N'

        ownerDEL = kennel.find_owner('DEL')
        aDog = ownerDEL.all_my_dogs[0]
        assert aDog.my_owner, ownerDEL
        assert aDog.name == 'Ruftero'
        assert aDog.favorite_food == 'Ekanuba'
        assert aDog.breed == 'Poodle'
        assert aDog.gender == 'F'
        aDog = ownerDEL.all_my_dogs[1]
        assert aDog.my_owner, ownerDEL
        assert aDog.name == 'Sausage'
        assert aDog.favorite_food == 'Purina'
        assert aDog.breed == 'Dachshund'
        assert aDog.gender == 'F'

        ownerARC = kennel.find_owner('ACR')
        aDog = ownerARC.all_my_dogs[0]
        assert aDog.my_owner, ownerARC
        assert aDog.name == 'Random'
        assert aDog.favorite_food == 'Cat'
        assert aDog.breed == 'Mastiff'
        assert aDog.gender == 'F'
    def test_a_donor_donor_have_correct_donations_number(self):
        blood_bank = controller.setup()

        donor4023500 = blood_bank.find_donor(4023500)
        assert len(donor4023500.all_my_donations) == 1

        donor5000990 = blood_bank.find_donor(5000990)
        assert len(donor5000990.all_my_donations) == 1

        donor6896701 = blood_bank.find_donor(6896701)
        assert len(donor6896701.all_my_donations) == 1

        donor7906553 = blood_bank.find_donor(7906553)
        assert len(donor7906553.all_my_donations) == 1

        donor9800100 = blood_bank.find_donor(9800100)
        assert len(donor9800100.all_my_donations) == 2
    def test_b_set_correct_format_of_activity_details(self):
        club = controller.setup()

        memberM01 = club.find_member('M01')
        anActivity = memberM01.all_my_activities[0]
        assert anActivity.name == 'Autumn Festival'
        assert anActivity.place == 'Arrowtown'
        assert anActivity.start_date == date(2018, 1, 1)
        assert anActivity.cost == 0

        memberM05 = club.find_member('M05')
        anActivity = memberM05.all_my_activities[0]
        assert anActivity.name == 'Joyride Carnival'
        assert anActivity.place == 'Auckland'
        assert anActivity.start_date == date(2019, 5, 2)
        assert anActivity.cost == 300.00

        memberM05 = club.find_member('M05')
        anActivity = memberM05.all_my_activities[1]
        assert anActivity.name == 'Easter High Tea'
        assert anActivity.place == 'Wellington'
        assert anActivity.start_date == date(2018, 12, 10)
        assert anActivity.cost == 150.00

        memberM05 = club.find_member('M05')
        anActivity = memberM05.all_my_activities[2]
        assert anActivity.name == 'Festival of Colour'
        assert anActivity.place == 'Hamilton'
        assert anActivity.start_date == date(2018, 11, 7)
        assert anActivity.cost == 0

        memberM02 = club.find_member('M02')
        anActivity = memberM02.all_my_activities[0]
        assert anActivity.name == 'Wine and Food Festival'
        assert anActivity.place == 'Napier'
        assert anActivity.start_date == date(2020, 10, 20)
        assert anActivity.cost == 350.00

        memberM04 = club.find_member('M04')
        anActivity = memberM04.all_my_activities[0]
        assert anActivity.name == 'Music in Park'
        assert anActivity.place == 'Hamilton'
        assert anActivity.start_date == date(2018, 12, 8)
        assert anActivity.cost == 0
    def test_b_set_correct_format_of_donations_details(self):
        blood_bank = controller.setup()

        donor4023500 = blood_bank.find_donor(4023500)
        donations = donor4023500.all_my_donations[0]
        assert donations.branch_name == 'Christchurch'
        assert donations.town == 'Addington'
        assert donations.when == date(2018, 11, 1)
        assert donations.blood_group == 'AB+'

        donor5000990 = blood_bank.find_donor(5000990)
        donations = donor5000990.all_my_donations[0]
        assert donations.branch_name == 'Wellington'
        assert donations.town == 'Newtown'
        assert donations.when == date(2017, 7, 11)
        assert donations.blood_group == 'O-'

        donor6896701 = blood_bank.find_donor(6896701)
        donations = donor6896701.all_my_donations[0]
        assert donations.branch_name == 'Auckland'
        assert donations.town == 'Manuka'
        assert donations.when == date(2019, 6, 15)
        assert donations.blood_group == 'O+'

        donor7906553 = blood_bank.find_donor(7906553)
        donations = donor7906553.all_my_donations[0]
        assert donations.branch_name == 'North Shore'
        assert donations.town == 'Takapuna'
        assert donations.when == date(2016, 11, 9)
        assert donations.blood_group == 'B-'

        donor9800100 = blood_bank.find_donor(9800100)
        donations = donor9800100.all_my_donations[0]
        assert donations.branch_name == 'Nelson'
        assert donations.town == 'Tahunanui'
        assert donations.when == date(2017, 10, 9)
        assert donations.blood_group == 'AB+'

        donor9800100 = blood_bank.find_donor(9800100)
        donations = donor9800100.all_my_donations[1]
        assert donations.branch_name == 'Otago'
        assert donations.town == 'Dunedin'
        assert donations.when == date(2018, 9, 5)
        assert donations.blood_group == 'AB+'
 def test_e_display_pools_correct_format(self):
     the_rwc = controller.setup()
     returned = the_rwc.display_pools()
     self.assertEqual(returned, "A\nB\nC\nD\n")
Example #18
0
 def test_a_has_5_Members(self):
     club = controller.setup()
     assert len(club.all_my_members) == 5
 def test_cd_say_starts_on(self):
     club = controller.setup()
     returned = club.display_busy_members()
     expected = r'starts on'
     assert re.search(expected, returned)
Example #20
0
 def test_f_cattery_get_those_with_many_cats_works(self):
     cattery = controller.setup()
     returned = cattery.get_those_with_many_cats()
     assert returned == 'Casey, van Dyke [23]\n\tBlackey (N) aka Her Majesty\n\tFluffy (M) aka Grey ghost\n\tInky ' \
                        '(F) aka The Talker\n '
 def test_ci_space_after_at(self):
     club = controller.setup()
     returned = club.display_busy_members()
     expected = r'[,\s]'
     assert re.search(expected, returned)
 def setUp(self):
     self.rwc = setup()
Example #23
0
 def test_f_kennel_get_those_with_one_dog_works(self):
     kennel = controller.setup()
     returned = kennel.get_those_with_one_dog()
     assert returned == 'Andrew, Carter [ACR]\n  Random (F) the Mastiff who likes to eat Cat\nBrad, ' \
                        'McCaw [BMC]\n  ' \
                        'Speedy (N) the Pomeranian who likes to eat Ekanuba\n'
 def test_cf_display_starts_date(self):
     club = controller.setup()
     returned = club.display_busy_members()
     expected = r'05/02/19'
     assert re.search(expected, returned)
 def test_ck_line_should_end_and_tab_here(self):
     club = controller.setup()
     returned = club.display_busy_members()
     expected = r'[\n\t]'
     assert re.search(expected, returned)
 def test_cj_display_Auckland(self):
     club = controller.setup()
     returned = club.display_busy_members()
     expected = r'Auckland'
     assert re.search(expected, returned)
 def test_xxx_club_display_busy_members_works(self):
     club = controller.setup()
     returned = club.display_busy_members()
     assert returned == 'Beam, Jim [M05]\n\tFestival of Colour starts on 11/07/18 at Hamilton\n\tEaster High Tea ' \
                        'starts on 12/10/18 at Wellington\n\tJoyride Carnival starts on 05/02/19 at Auckland\n'
 def test_ch_say_at(self):
     club = controller.setup()
     returned = club.display_busy_members()
     expected = r'at'
     assert re.search(expected, returned)
Example #29
0
        controller.projectFilesContextMenu(self, point)
    
    def getTreeItemPath(self, treeItem, path):
        if not type(treeItem.parent()) == types.NoneType:
            path = self.getTreeItemPath(treeItem.parent(), path)
        
        path = os.path.join(path, str(treeItem.text(0)))
        return path
    
    def removeTreeItem(self, item):
        parent = item.parent()
        if not type(parent) == types.NoneType:
            parent.takeChild(parent.indexOfChild(item))
        else:
            tree = item.treeWidget()
            index = tree.indexOfTopLevelItem(item)
            tree.takeTopLevelItem(index)


if __name__ == "__main__":
    import sys
    app = QApplication(sys.argv)
    MainWindow = QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    ui.connectSignalsAndSlots(MainWindow)
    
    MainWindow.show()
    controller.setup(ui)
    sys.exit(app.exec_())
 def test_d_members_last_name(self):
     club = controller.setup()
     returned = club.display_busy_members()
     expected = r'^Beam'
     assert re.search(expected, returned)
Example #31
0
 def test_a_has_4_Owners(self):
     cattery = controller.setup()
     assert len(cattery.all_my_owners) == 4
 def test_e_puntuation_after_last_name(self):
     club = controller.setup()
     returned = club.display_busy_members()
     expected = r'[,]'
     assert re.search(expected, returned)