Tests the outputting of the correct name if assigned one.
(self)
| 11 | """ |
| 12 | |
| 13 | def test_name(self): |
| 14 | """ |
| 15 | Tests the outputting of the correct name if assigned one. |
| 16 | """ |
| 17 | # First try using a "normal" field |
| 18 | field = models.CharField(max_length=65) |
| 19 | name, path, args, kwargs = field.deconstruct() |
| 20 | self.assertIsNone(name) |
| 21 | field.set_attributes_from_name("is_awesome_test") |
| 22 | name, path, args, kwargs = field.deconstruct() |
| 23 | self.assertEqual(name, "is_awesome_test") |
| 24 | # Now try with a ForeignKey |
| 25 | field = models.ForeignKey("some_fake.ModelName", models.CASCADE) |
| 26 | name, path, args, kwargs = field.deconstruct() |
| 27 | self.assertIsNone(name) |
| 28 | field.set_attributes_from_name("author") |
| 29 | name, path, args, kwargs = field.deconstruct() |
| 30 | self.assertEqual(name, "author") |
| 31 | |
| 32 | def test_db_tablespace(self): |
| 33 | field = models.Field() |
nothing calls this directly
no test coverage detected