Esempio n. 1
0
    def test_invalid_property(self, mock):
        # replacing requests.get with mock method
        mock.return_value = self.mock_get

        # performing tests
        with self.assertRaises(bottle.HTTPError):
            x = app.zkb_stats('xyz', '0', 'shipsDestroyed')
Esempio n. 2
0
    def test_isk_lost(self, mock):
        # replacing requests.get with mock method
        mock.return_value = self.mock_get

        # performing tests
        x = app.zkb_stats('alliance', '0', 'iskLost')
        self.assertDictEqual(
            json.loads(x), {
                'schemaVersion': 1,
                'label': 'ISK Lost',
                'message': '83.2t',
                'color': 'critical',
                'cacheSeconds': app.Shield.CACHE_SECONDS
            })
Esempio n. 3
0
    def test_isk_destroyed(self, mock):
        # replacing requests.get with mock method
        mock.return_value = self.mock_get

        # performing tests
        x = app.zkb_stats('alliance', '0', 'iskDestroyed')
        self.assertDictEqual(
            json.loads(x), {
                'schemaVersion': 1,
                'label': 'ISK Destroyed',
                'message': '154.0t',
                'color': 'success',
                'cacheSeconds': app.Shield.CACHE_SECONDS
            })
Esempio n. 4
0
    def test_danger_ratio(self, mock):
        # replacing requests.get with mock method
        mock.return_value = self.mock_get

        # performing tests
        x = app.zkb_stats('alliance', '0', 'dangerRatio')
        self.assertDictEqual(
            json.loads(x), {
                'schemaVersion': 1,
                'label': 'Danger',
                'message': 'Snuggly 55%',
                'color': 'green',
                'cacheSeconds': app.Shield.CACHE_SECONDS
            })
Esempio n. 5
0
    def test_corp_count(self, mock):
        # replacing requests.get with mock method
        mock.return_value = self.mock_get

        # performing tests
        x = app.zkb_stats('alliance', '0', 'corpCount')
        self.assertDictEqual(
            json.loads(x), {
                'schemaVersion': 1,
                'label': 'Corporations',
                'message': '66',
                'color': 'informational',
                'cacheSeconds': app.Shield.CACHE_SECONDS
            })
Esempio n. 6
0
    def test_activeP_pvp_chars(self, mock):
        # replacing requests.get with mock method
        mock.return_value = self.mock_get

        # performing tests
        x = app.zkb_stats('alliance', '0', 'activePvpChars')
        self.assertDictEqual(
            json.loads(x), {
                'schemaVersion': 1,
                'label': 'Active PVP chars',
                'message': '1.6k',
                'color': 'informational',
                'cacheSeconds': app.Shield.CACHE_SECONDS
            })
Esempio n. 7
0
    def test_ships_eff(self, mock):
        # replacing requests.get with mock method
        mock.return_value = self.mock_get

        # performing tests
        x = app.zkb_stats('alliance', '0', 'shipsEff')
        self.assertDictEqual(
            json.loads(x), {
                'schemaVersion': 1,
                'label': 'Ships Efficiency',
                'message': '49%',
                'color': 'critical',
                'cacheSeconds': app.Shield.CACHE_SECONDS
            })