def test_node_license_updates_correctly(self): other_license = NodeLicense.find_one(Q('name', 'eq', 'MIT License')) new_license = NodeLicenseRecordFactory(node_license=other_license) self.node.node_license = new_license self.node.save() docs = query(self.query)['results'] for doc in docs: assert_equal(doc['license'].get('id'), new_license.id)
def test_node_license_updates_correctly(self): other_license = NodeLicense.find_one( Q('name', 'eq', 'MIT License') ) new_license = NodeLicenseRecordFactory(node_license=other_license) self.node.node_license = new_license self.node.save() docs = query(self.query)['results'] for doc in docs: assert_equal(doc['license'].get('id'), new_license.id)
def to_internal_value(self, license_id): license = NodeLicense.load(license_id) return {'license_type': license}
def get_license(name): try: license = NodeLicense.find_one(Q('name', 'eq', name)) except NoResultsFound: raise Exception('License: "{}" not found'.format(name)) return license
def to_internal_value(self, license_id): license = NodeLicense.load(license_id) if license: return {'license_type': license} raise exceptions.NotFound('Unable to find specified license.')