diff options
| author | Vajrasky Kok <sky.kok@speaklikeaking.com> | 2013-11-27 23:01:18 +0800 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-11-28 08:48:38 -0500 |
| commit | d1df395f3ae768e495a105db2f85352c44ba1c28 (patch) | |
| tree | 3a057513b234d2a253f4d5036193accb30b4da06 /tests/custom_pk | |
| parent | 077af42139db84d88f293ab5eadc989a9169dce1 (diff) | |
Fixed #21517 -- Added unit test for non-autoincrement primary key with value 0.
Diffstat (limited to 'tests/custom_pk')
| -rw-r--r-- | tests/custom_pk/tests.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/custom_pk/tests.py b/tests/custom_pk/tests.py index 22369747a9..449e724acc 100644 --- a/tests/custom_pk/tests.py +++ b/tests/custom_pk/tests.py @@ -153,6 +153,13 @@ class CustomPKTests(TestCase): with transaction.atomic(): Employee.objects.create(employee_code=123, first_name="Fred", last_name="Jones") + def test_zero_non_autoincrement_pk(self): + Employee.objects.create( + employee_code=0, first_name="Frank", last_name="Jones" + ) + employee = Employee.objects.get(pk=0) + self.assertEqual(employee.employee_code, 0) + def test_custom_field_pk(self): # Regression for #10785 -- Custom fields can be used for primary keys. new_bar = Bar.objects.create() |
