Created
February 9, 2013 11:24
-
-
Save borntyping/4744924 to your computer and use it in GitHub Desktop.
New PyTentd testing example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_create_new_profile(self, entity): | |
schema = 'https://testprofile.example.com/' | |
data = {'data': 'test'} | |
response = PUT('entity.profile', data, secure=True, schema=schema) | |
profile = entity.profiles.get(schema=schema) | |
assert response.json() == profile.to_json() == data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_entity_update_create_new_profile(self): | |
"""Tests that a new profile is created.""" | |
schema = 'https://testprofile.example.com/' | |
update_data = { | |
'data': 'test'} | |
resp = self.client.put( | |
'{}/profile/{}'.format(self.name, schema), | |
data=dumps(update_data), content_type='application/json') | |
self.assertStatus(resp, 200) | |
profile = self.entity.profiles.get(schema=schema) | |
self.assertEquals(profile.to_json()['data'], update_data['data']) | |
self.assertEquals(profile.schema, schema) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment