Пример #1
0
 def test_get_all_devices(self):
     """
     """
     all_devices = get_all_devices(auth)
     self.assertIs(type(all_devices[0]['deviceId']), int)
     self.assertIs(type(all_devices[0]['deviceType']), str)
     self.assertIs(type(all_devices[0]['latitude']), float)
     self.assertIs(type(all_devices[0]['locationName']), str)
     self.assertIs(type(all_devices[0]['longitude']), float)
     self.assertIs(type(all_devices[0]['name']), str)
Пример #2
0
This module is used for testing the functions within the pyawair.objects module.
"""

from unittest import TestCase
from unittest import mock
from pyawair.objects import *
from pyawair.auth import AwairAuth
from pyawair.devices import get_all_devices

hobbiest = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiRFVNTVktSE9CQllJU1QifQ.hzjhIpGljqCZ8vCrOr89POy_ENDPYQXsnzGslP01krI'
small_dev = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiRFVNTVktU01BTExfREVWRUxPUEVSIn0.amOu5uy-0UeBDRLd6uhqsbkUEyx13-4QdBrV1S3z2W8'
large_dev = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiRFVNTVktTEFSR0VfREVWRUxPUEVSIn0.JmP9a0eGjgYRlmri5BjNj4h1hlAZ-7yFOjcIZjyzypA'
enterprise_dev = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiRFVNTVktRU5URVJQUklTRSJ9.bOM9rcABF9HKFHtxzF9kx8h9fv3CfvUIzveLFDRGrXs'

auth = AwairAuth(enterprise_dev)
dev1 = get_all_devices(auth)[0]


class TestGetCurrentAirData(TestCase):
    """
    Test Case for pyawair.objects AwairDev class
    """
    def test_create_AwairDev_pos(self):
        """
        """
        new_device = AwairDev(dev1['name'], auth)
        self.assertEqual(new_device._type, 'awair')
        self.assertEqual(new_device._id, 0)
        self.assertEqual(new_device._device_name, dev1['name'])

    def test_get_state_method(self):
Пример #3
0
"""

from unittest import TestCase
from pyawair.devices import *
from pyawair.auth import AwairAuth
from pyawair.devices import get_all_devices
from nose.plugins.skip import SkipTest

hobbiest = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiRFVNTVktSE9CQllJU1QifQ.hzjhIpGljqCZ8vCrOr89POy_ENDPYQXsnzGslP01krI'
small_dev = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiRFVNTVktU01BTExfREVWRUxPUEVSIn0.amOu5uy-0UeBDRLd6uhqsbkUEyx13-4QdBrV1S3z2W8'
large_dev = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiRFVNTVktTEFSR0VfREVWRUxPUEVSIn0.JmP9a0eGjgYRlmri5BjNj4h1hlAZ-7yFOjcIZjyzypA'
enterprise_dev = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiRFVNTVktRU5URVJQUklTRSJ9.bOM9rcABF9HKFHtxzF9kx8h9fv3CfvUIzveLFDRGrXs'

auth = AwairAuth(hobbiest)

dev1 = get_all_devices(auth)[0]
dev2 = get_all_devices(auth)[1]
all_devs_hob = get_all_devices(auth)

# TODO Remarked out failing tests


class TestGetUserData(TestCase):
    """
    Test Case for pyawair.devices get_user_data function
    """
    def test_get_user_data(self):
        """
        """
        #breaking changes in the Awair API
        raise SkipTest