Revision 3a5994a8 snf-pithos-app/pithos/api/test/objects.py

b/snf-pithos-app/pithos/api/test/objects.py
733 733
        self.assertEqual(r.status_code, 200)
734 734
        self.assertEqual(r.content, data)
735 735

  
736
    def test_create_object_by_invalid_hashmap(self):
737
        cname = self.container
738
        block_size = pithos_settings.BACKEND_BLOCK_SIZE
739

  
740
        # upload an object
741
        oname, data = self.upload_object(cname, length=block_size + 1)[:-1]
742
        # get it hashmap
743
        url = join_urls(self.pithos_path, self.user, cname, oname)
744
        r = self.get('%s?hashmap=&format=json' % url)
745
        data = r.content
746
        try:
747
            hashmap = json.loads(data)
748
        except:
749
            self.fail('JSON format expected')
750

  
751
        oname = get_random_name()
752
        url = join_urls(self.pithos_path, self.user, cname, oname)
753
        hashmap['hashes'] = [get_random_name()]
754
        r = self.put('%s?hashmap=' % url, data=json.dumps(hashmap))
755
        self.assertEqual(r.status_code, 400)
756

  
736 757

  
737 758
class ObjectPutCopy(PithosAPITest):
738 759
    def setUp(self):

Also available in: Unified diff