Beispiel #1
0
    def test_resource_object(self):
        provider = BlogProvider()
        resource = provider.request_resource(
            'http://example.com/testapp/blog/2010/may/01/entry-1/')

        blog_obj = Blog.objects.get(slug='entry-1')
        self.assertEqual(blog_obj, resource.content_object)
Beispiel #2
0
 def test_meta_queryset_behavior(self):
     provider = BlogProvider()
     
     obj = provider.get_object('http://example.com/testapp/blog/2010/may/01/entry-1/')
     blog_obj = Blog.objects.get(slug='entry-1')
     self.assertEqual(obj, blog_obj)
     
     new_obj = Blog.objects.create(
         title='new entry',
         author='new author',
         pub_date=datetime.datetime(2010, 1, 1),
     )
     oembed_obj = provider.get_object('http://example.com/testapp/blog/2010/jan/01/new-entry/')
     
     self.assertEqual(new_obj, oembed_obj)
Beispiel #3
0
    def test_meta_queryset_behavior(self):
        provider = BlogProvider()

        obj = provider.get_object(
            'http://example.com/testapp/blog/2010/may/01/entry-1/')
        blog_obj = Blog.objects.get(slug='entry-1')
        self.assertEqual(obj, blog_obj)

        new_obj = Blog.objects.create(
            title='new entry',
            author='new author',
            pub_date=datetime.datetime(2010, 1, 1),
        )
        oembed_obj = provider.get_object(
            'http://example.com/testapp/blog/2010/jan/01/new-entry/')

        self.assertEqual(new_obj, oembed_obj)
Beispiel #4
0
 def test_resource_object(self):
     provider = BlogProvider()
     resource = provider.request_resource('http://example.com/testapp/blog/2010/may/01/entry-1/')
     
     blog_obj = Blog.objects.get(slug='entry-1')
     self.assertEqual(blog_obj, resource.content_object)