Exemple #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)
     }
Exemple #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)
Exemple #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,
            },
        )
Exemple #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)
     }
Exemple #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')
Exemple #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
            }
        ]
Exemple #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)
Exemple #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,
                           })
Exemple #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')
Exemple #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)
     }
Exemple #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
        }]
Exemple #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")
Exemple #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,
        })
Exemple #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)
     }
Exemple #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)}
Exemple #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)
        }
Exemple #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)
     }
Exemple #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)
     }
Exemple #19
0
    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')
Exemple #20
0
 def setUp(self):
     self.user, pwd = create_user()
     self.client = Client()
     self.extra = {
         "HTTP_AUTHORIZATION": create_auth_string(self.user.username, pwd)
     }
Exemple #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")
Exemple #22
0
 def setUp(self):
     self.user, pwd = create_user()
     self.client = Client()
     self.extra = {
         'HTTP_AUTHORIZATION': create_auth_string(self.user.username, pwd)
     }