Example #1
0
 def setUp(self):
     self.podcast = Podcast.objects.get_or_create_for_url(
         "http://example.com/directory-podcast.xml",
         defaults={
             "title": "My Podcast"
         }).object
     self.episode = Episode.objects.get_or_create_for_url(
         self.podcast,
         "http://example.com/directory-podcast/1.mp3",
         defaults={
             "title": "My Episode"
         },
     ).object
     User = get_user_model()
     self.password = "******"
     self.username = "******"
     self.user = User(username=self.username, email="*****@*****.**")
     self.user.set_password(self.password)
     self.user.save()
     self.user.is_active = True
     self.client = Client()
     self.extra = {
         "HTTP_AUTHORIZATION": create_auth_string(self.username,
                                                  self.password)
     }
Example #2
0
 def setUp(self):
     User = get_user_model()
     self.password = "******"
     self.username = "******"
     self.device_uid = "test-device"
     self.user = User(username=self.username, email="*****@*****.**")
     self.user.set_password(self.password)
     self.user.save()
     self.user.is_active = True
     self.client = Client()
     self.extra = {
         "HTTP_AUTHORIZATION": create_auth_string(self.username,
                                                  self.password)
     }
     self.formats = ["txt", "json", "jsonp", "opml"]
     self.subscriptions_urls = dict(
         (fmt, self.get_subscriptions_url(fmt)) for fmt in self.formats)
     self.blank_values = {
         "txt": b"\n",
         "json": b"[]",
         "opml": Exporter("Subscriptions").generate([]),
     }
     self.all_subscriptions_url = reverse(
         "api-all-subscriptions",
         kwargs={
             "format": "txt",
             "username": self.user.username
         },
     )
     self.toplist_urls = dict(
         (fmt, self.get_toplist_url(fmt)) for fmt in self.formats)
     self.search_urls = dict(
         (fmt, self.get_search_url(fmt)) for fmt in self.formats)
Example #3
0
    def setUp(self):
        User = get_user_model()
        self.password = "******"
        self.username = "******"
        self.device_uid = "test-device"
        self.user = User(username=self.username, email="*****@*****.**")
        self.user.set_password(self.password)
        self.user.save()
        self.user.is_active = True
        self.client = Client()

        self.extra = {
            "HTTP_AUTHORIZATION": create_auth_string(self.username,
                                                     self.password)
        }

        self.action_data = {"add": ["http://example.com/podcast.rss"]}

        self.url = reverse(
            "subscriptions-api",
            kwargs={
                "version": "2",
                "username": self.user.username,
                "device_uid": self.device_uid,
            },
        )
Example #4
0
 def setUp(self):
     self.user, pwd = create_user()
     self.client = TClient()
     wrong_pwd = pwd + '1234'
     self.extra = {
         'HTTP_AUTHORIZATION': create_auth_string(self.user.username, wrong_pwd)
     }
Example #5
0
    def setUpClass(self):
        User = get_user_model()
        self.user = User(username='******', email='*****@*****.**')
        self.user.set_password('pwd')
        self.user.save()

        self.auth_string = create_auth_string('test', 'pwd')
Example #6
0
    def setUp(self):
        User = get_user_model()
        self.password = '******'
        self.username = '******'
        self.user = User(username=self.username, email='*****@*****.**')
        self.user.set_password(self.password)
        self.user.save()
        self.user.is_active = True
        self.client = Client()

        self.extra = {
            'HTTP_AUTHORIZATION': create_auth_string(self.username,
                                                     self.password)
        }

        self.action_data = [
            {
                "podcast": "http://example.com/feed.rss",
                "episode": "http://example.com/files/s01e20.mp3",
                "device": "gpodder_abcdef123",
                "action": "download",
                "timestamp": "2009-12-12T09:00:00"
            },
            {
                "podcast": "http://example.org/podcast.php",
                "episode": "http://ftp.example.org/foo.ogg",
                "action": "play",
                "started": 15,
                "position": 120,
                "total":  500
            }
        ]
Example #7
0
 def setUp(self):
     User = get_user_model()
     self.password = '******'
     self.username = '******'
     self.device_uid = 'test-device'
     self.user = User(username=self.username, email='*****@*****.**')
     self.user.set_password(self.password)
     self.user.save()
     self.user.is_active = True
     self.client = Client()
     self.extra = {
         'HTTP_AUTHORIZATION': create_auth_string(self.username,
                                                  self.password)
     }
     self.formats = ['txt', 'json', 'jsonp', 'opml']
     self.subscriptions_urls = dict(
         (fmt, self.get_subscriptions_url(fmt)) for fmt in self.formats)
     self.blank_values = {
         'txt': b'\n',
         'json': b'[]',
         'opml': Exporter('Subscriptions').generate([]),
     }
     self.all_subscriptions_url = reverse(
         'api-all-subscriptions',
         kwargs={
             'format': 'txt',
             'username': self.user.username
         },
     )
     self.toplist_urls = dict(
         (fmt, self.get_toplist_url(fmt)) for fmt in self.formats)
     self.search_urls = dict(
         (fmt, self.get_search_url(fmt)) for fmt in self.formats)
Example #8
0
    def setUp(self):
        User = get_user_model()
        self.password = '******'
        self.username = '******'
        self.device_uid = 'test-device'
        self.user = User(username=self.username, email='*****@*****.**')
        self.user.set_password(self.password)
        self.user.save()
        self.user.is_active = True
        self.client = Client()

        self.extra = {
            'HTTP_AUTHORIZATION': create_auth_string(self.username,
                                                     self.password)
        }

        self.action_data = {
            'add': ['http://example.com/podcast.rss'],
        }

        self.url = reverse('subscriptions-api',
                           kwargs={
                               'version': '2',
                               'username': self.user.username,
                               'device_uid': self.device_uid,
                           })
Example #9
0
    def setUpClass(self):
        User = get_user_model()
        self.user = User(username='******', email='*****@*****.**')
        self.user.set_password('pwd')
        self.user.save()

        self.auth_string = create_auth_string('test', 'pwd')
Example #10
0
 def setUp(self):
     self.user, pwd = create_user()
     self.client = TClient()
     wrong_pwd = pwd + '1234'
     self.extra = {
         'HTTP_AUTHORIZATION': create_auth_string(self.user.username, wrong_pwd)
     }
Example #11
0
    def setUp(self):
        User = get_user_model()
        self.password = '******'
        self.username = '******'
        self.user = User(username=self.username, email='*****@*****.**')
        self.user.set_password(self.password)
        self.user.save()
        self.user.is_active = True
        self.client = Client()

        self.extra = {
            'HTTP_AUTHORIZATION': create_auth_string(self.username,
                                                     self.password)
        }

        self.action_data = [{
            "podcast": "http://example.com/feed.rss",
            "episode": "http://example.com/files/s01e20.mp3",
            "device": "gpodder_abcdef123",
            "action": "download",
            "timestamp": "2009-12-12T09:00:00"
        }, {
            "podcast": "http://example.org/podcast.php",
            "episode": "http://ftp.example.org/foo.ogg",
            "action": "play",
            "started": 15,
            "position": 120,
            "total": 500
        }]
Example #12
0
    def setUpClass(self):
        User = get_user_model()
        self.user = User(username="******", email="*****@*****.**")
        self.user.set_password("pwd")
        self.user.save()

        self.auth_string = create_auth_string("test", "pwd")
Example #13
0
    def setUp(self):
        User = get_user_model()
        self.password = '******'
        self.username = '******'
        self.device_uid = 'test-device'
        self.user = User(username=self.username, email='*****@*****.**')
        self.user.set_password(self.password)
        self.user.save()
        self.user.is_active = True
        self.client = Client()

        self.extra = {
            'HTTP_AUTHORIZATION': create_auth_string(self.username,
                                                     self.password)
        }

        self.action_data = {
            'add': ['http://example.com/podcast.rss'],
        }

        self.url = reverse('subscriptions-api', kwargs={
            'version': '2',
            'username': self.user.username,
            'device_uid': self.device_uid,
        })
Example #14
0
 def setUp(self):
     self.podcast = Podcast.objects.get_or_create_for_url(
         'http://example.com/directory-podcast.xml',
         defaults={
             'title': 'My Podcast',
         },
     ).object
     self.episode = Episode.objects.get_or_create_for_url(
         self.podcast,
         'http://example.com/directory-podcast/1.mp3',
         defaults={
             'title': 'My Episode',
         },
     ).object
     User = get_user_model()
     self.password = '******'
     self.username = '******'
     self.user = User(username=self.username, email='*****@*****.**')
     self.user.set_password(self.password)
     self.user.save()
     self.user.is_active = True
     self.client = Client()
     self.extra = {
         'HTTP_AUTHORIZATION': create_auth_string(self.username,
                                                  self.password)
     }
Example #15
0
    def setUp(self):
        self.user, pwd = create_user()
        self.podcast_url = 'http://example.com/podcast.rss'
        self.episode_url = 'http://example.com/podcast/episode-1.mp3'
        self.uid = 'client-uid'
        self.podcast = Podcast.objects.get_or_create_for_url(self.podcast_url).object

        self.episode = Episode.objects.get_or_create_for_url(
            self.podcast, self.episode_url
        ).object

        self.user_client = Client.objects.create(
            id=uuid.uuid1(), user=self.user, uid=self.uid
        )
        self.client = TClient()
        self.extra = {'HTTP_AUTHORIZATION': create_auth_string(self.user.username, pwd)}
Example #16
0
    def setUp(self):
        self.user, pwd = create_user()
        self.podcast_url = "http://example.com/podcast.rss"
        self.episode_url = "http://example.com/podcast/episode-1.mp3"
        self.uid = "client-uid"
        self.podcast = Podcast.objects.get_or_create_for_url(
            self.podcast_url).object

        self.episode = Episode.objects.get_or_create_for_url(
            self.podcast, self.episode_url).object

        self.user_client = Client.objects.create(id=uuid.uuid1(),
                                                 user=self.user,
                                                 uid=self.uid)
        self.client = TClient()
        self.extra = {
            "HTTP_AUTHORIZATION": create_auth_string(self.user.username, pwd)
        }
Example #17
0
 def setUp(self):
     self.user, pwd = create_user()
     self.podcast_url = 'http://example.com/podcast.rss'
     self.episode_url = 'http://example.com/podcast/episode-1.mp3'
     self.uid = 'client-uid'
     self.podcast = Podcast.objects.get_or_create_for_url(self.podcast_url)
     self.episode = Episode.objects.get_or_create_for_url(
         self.podcast,
         self.episode_url,
     )
     self.user_client = Client.objects.create(
         id=uuid.uuid1(),
         user=self.user,
         uid=self.uid,
     )
     self.client = TestClient()
     self.extra = {
         'HTTP_AUTHORIZATION': create_auth_string(self.user.username, pwd)
     }
Example #18
0
 def setUp(self):
     self.podcast = Podcast.objects.get_or_create_for_url(
         'http://example.com/directory-podcast.xml', defaults={'title': 'My Podcast'}
     ).object
     self.episode = Episode.objects.get_or_create_for_url(
         self.podcast,
         'http://example.com/directory-podcast/1.mp3',
         defaults={'title': 'My Episode'},
     ).object
     User = get_user_model()
     self.password = '******'
     self.username = '******'
     self.user = User(username=self.username, email='*****@*****.**')
     self.user.set_password(self.password)
     self.user.save()
     self.user.is_active = True
     self.client = Client()
     self.extra = {
         'HTTP_AUTHORIZATION': create_auth_string(self.username, self.password)
     }
Example #19
0
File: tests.py Project: Mic92/mygpo
    def setUp(self):
        self.user, _ = User.objects.get_or_create(username='******')
        self.user.set_password('pwd')
        self.user.save()

        self.auth_string = create_auth_string('test', 'pwd')
Example #20
0
 def setUp(self):
     self.user, pwd = create_user()
     self.client = Client()
     self.extra = {
         "HTTP_AUTHORIZATION": create_auth_string(self.user.username, pwd)
     }
Example #21
0
    def setUpClass(self):
        self.user = User(username="******", email="*****@*****.**")
        self.user.set_password("pwd")
        self.user.save()

        self.auth_string = create_auth_string("test", "pwd")
Example #22
0
 def setUp(self):
     self.user, pwd = create_user()
     self.client = Client()
     self.extra = {
         'HTTP_AUTHORIZATION': create_auth_string(self.user.username, pwd)
     }