Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error checking when adding to blaze server. #1459

Merged
merged 5 commits into from
Mar 23, 2016

Conversation

kwmsmith
Copy link
Member

Does basic error checking when adding a new data set to a blaze server (/add endpoint):

  • prevent adding a dataset when there's a name collision with existing dataset;
  • check that the data is discoverable to verify the data is loadable and queryable;
  • capture any other exception and return appropriate error code and traceback string.

I also reformatted the indentation in other tests for consistency.

@kwmsmith kwmsmith added this to the 0.10 milestone Mar 23, 2016
_get_auth.cache[app] = (
_get_option('authorization', options, None) or (lambda a: True)
)
_get_format.cache[app] = dict((f.name, f) for f in _get_option('formats', options))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably be a dict comprehension now

@llllllllll
Copy link
Member

It is hard to see what actually changed here, could you split this into two commits?

@llllllllll
Copy link
Member

Also, since this is mainly a style change, I would like to say that I don't find dict(key=value) as clear as {'key': value}. For dictionary literals I think this violates the "one obvious way to do something" principle.

resp = empty_server.post('/add',
headers=mimetype(serial),
data=payload)
assert resp.status_code == 409 # CONFLICT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these error codes not defined somewhere, and if not, should we make a small namespace for them like: rc.CONFLICT

@kwmsmith kwmsmith force-pushed the bugfix/blaze-server-add-errors branch from ea78b32 to 1a7fda0 Compare March 23, 2016 16:44
@kwmsmith
Copy link
Member Author

@llllllllll I split the commit up; 1a7fda0 is the core of the bugfixes, while 80da240 is the style and indentation fixup.


@pytest.mark.parametrize('serial', all_formats)
def test_add_data_twice_error(empty_server, serial):
with temp_server():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be a pytest.yield_fixture?

@kwmsmith kwmsmith merged commit 640fe88 into blaze:master Mar 23, 2016
@kwmsmith kwmsmith deleted the bugfix/blaze-server-add-errors branch March 23, 2016 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants