def test_setup_server_bucket(self): server = KintoServer('foo', 'baa') # if the server 403s on the bucket it's because it doesn't exist responses.add( responses.GET, settings.REMOTE_SETTINGS_WRITER_URL + 'buckets/foo', content_type='application/json', status=403) responses.add( responses.PUT, settings.REMOTE_SETTINGS_WRITER_URL + 'buckets/foo', content_type='application/json') # if the server 404s on the collection it's because it doesn't exist responses.add( responses.GET, settings.REMOTE_SETTINGS_WRITER_URL + 'buckets/foo/collections/baa', content_type='application/json', status=404) responses.add( responses.PUT, settings.REMOTE_SETTINGS_WRITER_URL + 'buckets/foo/collections/baa', content_type='application/json', status=201) server.setup_test_server_collection()
def test_setup_server_collection(self): server = KintoServer('foo', 'baa') # But if the bucket exists then the collection should still be created responses.add(responses.GET, settings.KINTO_API_URL + 'buckets/foo', content_type='application/json') responses.add(responses.GET, settings.KINTO_API_URL + 'buckets/foo/collections/baa', content_type='application/json', status=404) responses.add(responses.PUT, settings.KINTO_API_URL + 'buckets/foo/collections/baa', content_type='application/json', status=201) server.setup_test_server_collection()
def test_setup_test_server_collection(self): server = KintoServer('foo', 'baa') responses.add( responses.GET, settings.KINTO_API_URL + 'buckets/foo/collections/baa/records', content_type='application/json', status=403) responses.add( responses.PUT, settings.KINTO_API_URL + 'buckets/foo', content_type='application/json') responses.add( responses.PUT, settings.KINTO_API_URL + 'buckets/foo/collections/baa', content_type='application/json', status=201) server.setup_test_server_collection() # If repeated then the collection shouldn't 403 a second time responses.add( responses.GET, settings.KINTO_API_URL + 'buckets/foo/collections/baa/records', content_type='application/json') server.setup_test_server_collection()