예제 #1
0
 def test_from_document_with_id(self):
     license2 = LicenseKey.from_document({'_id': '666'})
     self.assertIsNotNone(license2)
     self.assertIsNotNone(license2.id)
     self.assertEqual('666', license2.id)
     self.assertIsNone(license2.name)
     self.assertIsNone(license2.key)
예제 #2
0
 def test_repr_id(self):
     license2 = LicenseKey.from_document({
         '_id': '666',
         'key': 'key',
         'name': 'name'
     })
     self.assertEquals("<LicenseKey(id='666', name='name', key='key')>",
                       str(license2))
예제 #3
0
    def test_from_document(self):
        license1 = LicenseKey.from_document({'key': 'key', 'name': 'name'})
        self.assertIsNotNone(license1)
        self.assertIsNone(license1.id)
        self.assertEqual('name', license1.name)
        self.assertEqual('key', license1.key)

        license2 = LicenseKey.from_document({
            '_id': '666',
            'key': 'key',
            'name': 'name'
        })
        self.assertIsNotNone(license2)
        self.assertIsNotNone(license2.id)
        self.assertEqual('666', license2.id)
        self.assertEqual('666', license2.id)
        self.assertEqual('name', license2.name)
        self.assertEqual('key', license2.key)
예제 #4
0
 def test_repr_no_id(self):
     license1 = LicenseKey.from_document({'key': 'key', 'name': 'name'})
     self.assertEquals("<LicenseKey(id='n/a', name='name', key='key')>",
                       str(license1))
예제 #5
0
 def test_from_document_no_id(self):
     license1 = LicenseKey.from_document({'key': 'key', 'name': 'name'})
     self.assertIsNotNone(license1)
     self.assertIsNone(license1.id)
     self.assertEqual('name', license1.name)
     self.assertEqual('key', license1.key)