Tests the migration autodetector.
| 223 | |
| 224 | |
| 225 | class AutodetectorTests(BaseAutodetectorTests): |
| 226 | """ |
| 227 | Tests the migration autodetector. |
| 228 | """ |
| 229 | |
| 230 | author_empty = ModelState( |
| 231 | "testapp", "Author", [("id", models.AutoField(primary_key=True))] |
| 232 | ) |
| 233 | author_name = ModelState( |
| 234 | "testapp", |
| 235 | "Author", |
| 236 | [ |
| 237 | ("id", models.AutoField(primary_key=True)), |
| 238 | ("name", models.CharField(max_length=200)), |
| 239 | ], |
| 240 | ) |
| 241 | author_name_null = ModelState( |
| 242 | "testapp", |
| 243 | "Author", |
| 244 | [ |
| 245 | ("id", models.AutoField(primary_key=True)), |
| 246 | ("name", models.CharField(max_length=200, null=True)), |
| 247 | ], |
| 248 | ) |
| 249 | author_name_longer = ModelState( |
| 250 | "testapp", |
| 251 | "Author", |
| 252 | [ |
| 253 | ("id", models.AutoField(primary_key=True)), |
| 254 | ("name", models.CharField(max_length=400)), |
| 255 | ], |
| 256 | ) |
| 257 | author_name_renamed = ModelState( |
| 258 | "testapp", |
| 259 | "Author", |
| 260 | [ |
| 261 | ("id", models.AutoField(primary_key=True)), |
| 262 | ("names", models.CharField(max_length=200)), |
| 263 | ], |
| 264 | ) |
| 265 | author_name_default = ModelState( |
| 266 | "testapp", |
| 267 | "Author", |
| 268 | [ |
| 269 | ("id", models.AutoField(primary_key=True)), |
| 270 | ("name", models.CharField(max_length=200, default="Ada Lovelace")), |
| 271 | ], |
| 272 | ) |
| 273 | author_name_db_default = ModelState( |
| 274 | "testapp", |
| 275 | "Author", |
| 276 | [ |
| 277 | ("id", models.AutoField(primary_key=True)), |
| 278 | ("name", models.CharField(max_length=200, db_default="Ada Lovelace")), |
| 279 | ], |
| 280 | ) |
| 281 | author_name_check_constraint = ModelState( |
| 282 | "testapp", |
nothing calls this directly
no test coverage detected