def test_namespace_url(self): uploaded = datetime.datetime.now() model = Namespace( keyword='TEST', url='http://test.com', name='Test Namespace', domain=NAMESPACE_DOMAIN_OTHER, species='9606', version='1.0.0', author='Charles Tapley Hoyt', contact='*****@*****.**', uploaded=uploaded, ) expected = dict( keyword='TEST', url='http://test.com', name='Test Namespace', version='1.0.0', ) self.assertEqual(model.to_json(), expected) expected['id'] = model.id = 1 self.assertEqual(model.to_json(include_id=True), expected)
def test_namespace_pattern(self): uploaded = datetime.datetime.now() model = Namespace(keyword='TEST', pattern='\w+', name='Test Namespace', domain=NAMESPACE_DOMAIN_OTHER, species='9606', version='1.0.0', author='Charles Tapley Hoyt', contact='*****@*****.**', uploaded=uploaded) expected = dict( keyword='TEST', pattern='\w+', name='Test Namespace', version='1.0.0', ) self.assertEqual(model.to_json(), expected)