Example #1
0
    def test_parseEventAlliances(self):
        with open('test_data/fms_api/2015waamv_staging_alliances.json',
                  'r') as f:
            alliances = FMSAPIEventAlliancesParser().parse(json.loads(
                f.read()))

        self.assertEqual(alliances, [{
            'declines': [],
            'picks': ['frc1', 'frc2', 'frc3']
        }, {
            'declines': [],
            'picks': ['frc5', 'frc6', 'frc7', 'frc8']
        }, {
            'declines': [],
            'picks': ['frc9', 'frc10', 'frc11', 'frc12']
        }, {
            'declines': [],
            'picks': ['frc13', 'frc14', 'frc15', 'frc16']
        }, {
            'declines': [],
            'picks': ['frc17', 'frc18', 'frc19', 'frc20']
        }, {
            'declines': [],
            'picks': ['frc21', 'frc22', 'frc23', 'frc24']
        }, {
            'declines': [],
            'picks': ['frc25', 'frc26', 'frc27', 'frc28']
        }, {
            'declines': [],
            'picks': ['frc29', 'frc30', 'frc31', 'frc31']
        }])
    def test_parse_ignore_no_picks(self):
        with open('test_data/fms_api/2019_ohwa2_alliances.json', 'r') as f:
            alliances = FMSAPIEventAlliancesParser().parse(json.loads(
                f.read()))

            self.assertTrue(isinstance(alliances, list))
            self.assertEqual(len(alliances), 7)
Example #3
0
    def test_parse_4team(self):
        with open('test_data/fms_api/2015_curie_alliances.json', 'r') as f:
            alliances = FMSAPIEventAlliancesParser().parse(json.loads(
                f.read()))

            self.assertTrue(isinstance(alliances, list))
            self.assertEqual(len(alliances), 8)

            number = 1
            for alliance in alliances:
                self.assertEqual(alliance['name'],
                                 'Alliance {}'.format(number))
                self.assertIsNone(alliance['backup'])
                number += 1
Example #4
0
    def test_parse_8alliances(self):
        with open('test_data/fms_api/2016_nyny_alliances.json', 'r') as f:
            alliances = FMSAPIEventAlliancesParser().parse(json.loads(
                f.read()))

            self.assertTrue(isinstance(alliances, list))
            self.assertEqual(len(alliances), 8)

            # Ensure that we have the alliances in the proper order and that backup teams propegate
            number = 1
            for alliance in alliances:
                self.assertEqual(alliance['name'],
                                 'Alliance {}'.format(number))
                self.assertIsNone(alliance['backup'])
                number += 1
Example #5
0
    def test_parse_backup_team_used(self):
        with open('test_data/fms_api/2016_necmp_alliances.json', 'r') as f:
            alliances = FMSAPIEventAlliancesParser().parse(json.loads(
                f.read()))

            self.assertTrue(isinstance(alliances, list))
            self.assertEqual(len(alliances), 8)

            number = 1
            for alliance in alliances:
                self.assertEqual(alliance['name'],
                                 'Alliance {}'.format(number))
                if number == 5:
                    self.assertIsNotNone(alliance['backup'])
                    self.assertEqual(alliance['backup']['in'], 'frc4905')
                    self.assertEqual(alliance['backup']['out'], 'frc999')
                else:
                    self.assertIsNone(alliance['backup'])
                number += 1
Example #6
0
    def test_parse_no_alliances(self):
        with open('test_data/fms_api/2016_no_alliances.json', 'r') as f:
            alliances = FMSAPIEventAlliancesParser().parse(json.loads(
                f.read()))

            self.assertIsNone(alliances)