Skip to content

Instantly share code, notes, and snippets.

@borntyping
Created February 9, 2013 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save borntyping/4744924 to your computer and use it in GitHub Desktop.
Save borntyping/4744924 to your computer and use it in GitHub Desktop.
New PyTentd testing example
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
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