Ejemplo n.º 1
0
class ItemSearchTest(unittest.TestCase):
    def setUp(self):
        self.g = GooglePlay(search='angry birds')

    def test_get_first(self):
        """
        The name field should be populated once the
        Item object has been initiated.
        """
        item = self.g.get_first()
        self.assertNotEqual(None, item.name)

    def test_get_first_page(self):
        """
        Each page should have some items.
        """
        items = self.g.get_first_page()
        self.assertGreater(len(items), 0)

    def test_fetch(self):
        """
        The fetch method for an Item object only fetches
        the detail page when a field on that page is requested.
        Description is one that is on that page, and should 
        be None before get_description() is ever ran.
        """
        item = self.g.get_first()
        before = item._description
        after = item.description
        self.assertEqual(before, None)
        self.assertNotEqual(before, after)
Ejemplo n.º 2
0
class ItemSearchTest(unittest.TestCase):

    def setUp(self):
        self.g = GooglePlay(search='angry birds')

    def test_get_first(self):
        """
        The name field should be populated once the
        Item object has been initiated.
        """
        item = self.g.get_first()
        self.assertNotEqual(None, item.name)

    def test_get_first_page(self):
        """
        Each page should have some items.
        """
        items = self.g.get_first_page()
        self.assertGreater(len(items), 0)

    def test_fetch(self):
        """
        The fetch method for an Item object only fetches
        the detail page when a field on that page is requested.
        Description is one that is on that page, and should 
        be None before get_description() is ever ran.
        """
        item = self.g.get_first()
        before = item._description
        after = item.description
        self.assertEqual(before, None)
        self.assertNotEqual(before, after)
Ejemplo n.º 3
0
 def __init__(self, config_path):
     with open(config_path) as config_file:
         config = json.load(config_file)
     xiaomi = config['xiaomi']
     self._xiaomi = Xiaomi(xiaomi['client_id'], xiaomi['client_secret'], xiaomi['public_key'],
                           xiaomi['verify_signature'], xiaomi['verify_api'], xiaomi['is_debug'])
     google_play = config['google_play']
     self._google_play = GooglePlay(google_play['public_key'])
     apple_app_store = config['apple_app_store']
     self._apple = Apple(apple_app_store['shared_secret'])
Ejemplo n.º 4
0
class UnityIAP():

    def __init__(self, config_path):
        with open(config_path) as config_file:
            config = json.load(config_file)
        xiaomi = config['xiaomi']
        self._xiaomi = Xiaomi(xiaomi['client_id'], xiaomi['client_secret'], xiaomi['public_key'],
                              xiaomi['verify_signature'], xiaomi['verify_api'], xiaomi['is_debug'])
        google_play = config['google_play']
        self._google_play = GooglePlay(google_play['public_key'])
        apple_app_store = config['apple_app_store']
        self._apple = Apple(apple_app_store['shared_secret'])

    def _verify_xiaomi_receipt(self, unified_receipt):
        payload = unified_receipt['Payload']
        return self._xiaomi.verify_receipt(payload)

    def _verify_google_play_receipt(self, unified_receipt):
        payload = unified_receipt['Payload']
        return self._google_play.verify_receipt(payload)

    def _verfiy_apple_app_store_receipt(self, unified_receipt):
        payload = unified_receipt['Payload']
        return self._apple.verify_receipt(payload)

    def verify_unified_receipt(self, unified_receipt):
        store = unified_receipt['Store']
        if store == Xiaomi.NAME:
            print(self._verify_xiaomi_receipt(unified_receipt)[0])
        elif store == GooglePlay.NAME:
            print(self._verify_google_play_receipt(unified_receipt)[0])
        elif store == Apple.NAME:
            print(self._verfiy_apple_app_store_receipt(unified_receipt)[0])
Ejemplo n.º 5
0
 def setUp(self):
     self.g = GooglePlay(search='angry birds')
Ejemplo n.º 6
0
 def test_movie(self):
     g = GooglePlay(search='Casablanca', media='movies')
     item = g.get_first()
     self.assertTrue(isinstance(item, Movie))
Ejemplo n.º 7
0
 def test_book(self):
     g = GooglePlay(search='The Hobbit', media='books')
     item = g.get_first()
     self.assertTrue(isinstance(item, Book)) 
Ejemplo n.º 8
0
 def test_app(self):
     g = GooglePlay(search='angry birds')
     item = g.get_first()
     self.assertTrue(isinstance(item, App))
Ejemplo n.º 9
0
 def setUp(self):
     self.g = GooglePlay(search='angry birds')
Ejemplo n.º 10
0
 def test_movie(self):
     g = GooglePlay(search='Casablanca', media='movies')
     item = g.get_first()
     self.assertTrue(isinstance(item, Movie))
Ejemplo n.º 11
0
 def test_book(self):
     g = GooglePlay(search='The Hobbit', media='books')
     item = g.get_first()
     self.assertTrue(isinstance(item, Book))
Ejemplo n.º 12
0
 def test_app(self):
     g = GooglePlay(search='angry birds')
     item = g.get_first()
     self.assertTrue(isinstance(item, App))