Exemplo n.º 1
0
    def test_get_fleetup_fittings(self, get_endpoint):

        get_endpoint.return_value = {
            "Data": [{
                'FittingId': 1234,
                'Name': 'Foxcat',
                'EveTypeId': 17726,
                'HullType': 'Battleship',
                'ShipType': 'Apocalypse Navy Issue',
                'EstPrice': 500000000,
                'Faction': 'Amarr',
                'Categories': ["Armor", "Laser"],
                'LastUpdatedString': '2017-05-06 11:11:11',
            }]
        }

        # Act
        result = FleetUpManager.get_fleetup_fittings()

        # Asset
        self.assertTrue(get_endpoint.called)
        expected_result = {
            1234: {
                'fitting_id': 1234,
                'name': 'Foxcat',
                'icon_id': 17726,
                'hull': 'Battleship',
                'shiptype': 'Apocalypse Navy Issue',
                'estimated': 500000000,
                'faction': 'Amarr',
                'categories': ["Armor", "Laser"],
                'last_update': datetime.datetime(2017, 5, 6, 11, 11, 11)
            }
        }
        self.assertDictEqual(expected_result, result)

        # Test None response
        # Arrange
        get_endpoint.return_value = None

        # Act
        result = FleetUpManager.get_fleetup_fittings()

        # Assert
        self.assertIsNone(result)

        # Test Empty response
        # Arrange
        get_endpoint.return_value = {'Data': []}

        # Act
        result = FleetUpManager.get_fleetup_fittings()

        # Assert
        self.assertDictEqual({}, result)
Exemplo n.º 2
0
def fleetup_fittings(request):
    logger.debug("fleetup_fittings called by user %s" % request.user)
    fitting_list = FleetUpManager.get_fleetup_fittings()
    context = {"fitting_list": sorted(fitting_list.items())}
    return render(request,
                  'registered/fleetupfittingsview.html',
                  context=context)
Exemplo n.º 3
0
def fleetup_fittings(request):
    logger.debug("fleetup_fittings called by user %s" % request.user)
    fitting_list = FleetUpManager.get_fleetup_fittings()

    if fitting_list is None:
        messages.add_message(
            request, messages.ERROR,
            _("Failed to get fitting list, contact your administrator"))
        fitting_list = {}

    context = {"fitting_list": sorted(fitting_list.items())}
    return render(request, 'fleetup/fittingsview.html', context=context)
Exemplo n.º 4
0
def fleetup_fittings(request):
    logger.debug("fleetup_fittings called by user %s" % request.user)
    fitting_list = FleetUpManager.get_fleetup_fittings()
    context = {"fitting_list": sorted(fitting_list.items())}
    return render(request, 'registered/fleetupfittingsview.html', context=context)