def test_file_create_content_defaults(self):
     content_defaults = DEFAULT_CONTENT_DEFAULTS
     post_data = {
         'file': SimpleUploadedFile("file.pdf", b"contents"),
         'content_defaults': json.dumps(content_defaults)
     }
     request = self.create_post_request(reverse_lazy('file_create'), post_data)
     response = file_create(request)
     self.assertTrue(response.status_code, 201)
Beispiel #2
0
 def test_file_create_content_defaults(self):
     content_defaults = DEFAULT_CONTENT_DEFAULTS
     post_data = {
         'file': SimpleUploadedFile("file.pdf", b"contents"),
         'content_defaults': json.dumps(content_defaults)
     }
     request = self.create_post_request(reverse_lazy('file_create'),
                                        post_data)
     response = file_create(request)
     self.assertTrue(response.status_code, 201)
    def setUp(self):
        super(NodeSettingTestCase, self).setUp()
        # Set up ricecooker trees
        self.channel.staging_tree = cc.ContentNode(kind_id=content_kinds.TOPIC, title="test", node_id="aaa")
        self.channel.staging_tree.save()
        self.channel.previous_tree = cc.ContentNode(kind_id=content_kinds.TOPIC, title="test", node_id="bbb")
        self.channel.previous_tree.save()
        self.channel.chef_tree = cc.ContentNode(kind_id=content_kinds.TOPIC, title="test", node_id="ccc")
        self.channel.chef_tree.save()
        self.channel.save()

        request = self.create_post_request(reverse_lazy('file_create'), {'file': SimpleUploadedFile("file.pdf", b"contents")})
        self.file_response = file_create(request)
    def setUp(self):
        super(NodeSettingTestCase, self).setUp()
        # Set up ricecooker trees
        self.channel.staging_tree = cc.ContentNode(kind_id=content_kinds.TOPIC,
                                                   title="test",
                                                   node_id="aaa")
        self.channel.staging_tree.save()
        self.channel.previous_tree = cc.ContentNode(
            kind_id=content_kinds.TOPIC, title="test", node_id="bbb")
        self.channel.previous_tree.save()
        self.channel.chef_tree = cc.ContentNode(kind_id=content_kinds.TOPIC,
                                                title="test",
                                                node_id="ccc")
        self.channel.chef_tree.save()
        self.channel.save()

        request = self.create_post_request(
            reverse_lazy('file_create'),
            {'file': SimpleUploadedFile("file.pdf", b"contents")})
        self.file_response = file_create(request)
Beispiel #5
0
 def test_file_create_no_content_defaults(self):
     post_data = {'file': SimpleUploadedFile("file.pdf", b"contents")}
     request = self.create_post_request(reverse_lazy('file_create'),
                                        post_data)
     response = file_create(request)
     self.assertTrue(response.status_code, 201)
 def test_file_create_no_content_defaults(self):
     post_data = {'file': SimpleUploadedFile("file.pdf", b"contents")}
     request = self.create_post_request(reverse_lazy('file_create'), post_data)
     response = file_create(request)
     self.assertTrue(response.status_code, 201)