Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
 def to_internal_value(self, license_id):
     license = NodeLicense.load(license_id)
     return {'license_type': license}
Пример #4
0
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 get_license(name):
    try:
        license = NodeLicense.find_one(Q('name', 'eq', name))
    except NoResultsFound:
        raise Exception('License: "{}" not found'.format(name))
    return license
Пример #6
0
 def to_internal_value(self, license_id):
     license = NodeLicense.load(license_id)
     return {'license_type': license}
Пример #7
0
 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.')