Add tagged test to Import/Export tests

This commit is contained in:
Christopher C. Wells 2022-05-28 06:56:24 -07:00 committed by Christopher Charbonneau Wells
parent fa746c68ca
commit 362f42d266
3 changed files with 50 additions and 36 deletions

View File

@ -1,11 +1,11 @@
id,child_id,child_first_name,child_last_name,name,slug,color,last_used
4,,,,everybody,everybody,#0000ff,2022-05-27 23:20:42
2,,,,lot,lot,#7fffff,2022-05-27 23:20:42
10,,,,method,method,#ffff00,2022-05-27 23:20:42
6,,,,military,military,#ffff7f,2022-05-27 23:20:43
1,,,,our,our,#ff7f7f,2022-05-27 23:20:43
2,,,,lot,lot,#7fffff,2022-05-27 23:20:42
3,,,,you,you,#007f7f,2022-05-27 23:20:42
4,,,,everybody,everybody,#0000ff,2022-05-27 23:20:42
5,,,,ten,ten,#7f7fff,2022-05-27 23:20:43
6,,,,military,military,#ffff7f,2022-05-27 23:20:43
7,,,,surface,surface,#ffff7f,2022-05-27 23:20:42
8,,,,table,table,#7f7fff,2022-05-27 23:20:43
5,,,,ten,ten,#7f7fff,2022-05-27 23:20:43
9,,,,treatment,treatment,#0000ff,2022-05-27 23:20:43
3,,,,you,you,#007f7f,2022-05-27 23:20:42
10,,,,method,method,#ffff00,2022-05-27 23:20:42
1 id child_id child_first_name child_last_name name slug color last_used
4 everybody everybody #0000ff 2022-05-27 23:20:42
2 lot lot #7fffff 2022-05-27 23:20:42
10 method method #ffff00 2022-05-27 23:20:42
6 military military #ffff7f 2022-05-27 23:20:43
2 1 our our #ff7f7f 2022-05-27 23:20:43
3 2 lot lot #7fffff 2022-05-27 23:20:42
4 3 you you #007f7f 2022-05-27 23:20:42
5 4 everybody everybody #0000ff 2022-05-27 23:20:42
6 5 ten ten #7f7fff 2022-05-27 23:20:43
7 6 military military #ffff7f 2022-05-27 23:20:43
8 7 surface surface #ffff7f 2022-05-27 23:20:42
9 8 table table #7f7fff 2022-05-27 23:20:43
5 ten ten #7f7fff 2022-05-27 23:20:43
10 9 treatment treatment #0000ff 2022-05-27 23:20:43
11 3 10 you method you method #007f7f #ffff00 2022-05-27 23:20:42

View File

@ -1,24 +1,24 @@
child_id,temperature,time
1,100.2,2020-02-17 09:31:49
1,99.62,2020-02-17 04:11:09
1,101.45,2020-02-17 00:14:09
1,97.41,2020-02-16 14:42:52
1,99.53,2020-02-16 11:28:41
1,98.92,2020-02-16 07:38:01
1,97.69,2020-02-15 22:53:01
1,98.37,2020-02-15 17:37:21
1,101.73,2020-02-15 07:51:45
1,98.31,2020-02-15 03:06:24
1,95.31,2020-02-14 12:12:28
1,99.5,2020-02-14 07:41:40
1,99.9,2020-02-13 18:05:46
1,98.33,2020-02-13 14:15:54
1,98.78,2020-02-13 09:39:03
1,98.51,2020-02-12 18:17:05
1,100.76,2020-02-12 05:54:01
1,98.96,2020-02-11 21:00:14
1,95.15,2020-02-11 17:33:04
1,95.89,2020-02-11 14:51:04
1,98.57,2020-02-11 08:30:34
1,99.16,2020-02-11 06:35:34
1,98.37,2020-02-10 10:25:06
id,child_id,child_first_name,child_last_name,temperature,time,notes,tags
83,1,Robert,Smith,97.81,2022-05-28 10:50:06,,
82,1,Robert,Smith,98.67,2022-05-28 03:09:33,,
81,1,Robert,Smith,95.29,2022-05-26 22:34:27,,
80,1,Robert,Smith,99.53,2022-05-26 18:03:27,,
79,1,Robert,Smith,96.72,2022-05-26 14:32:36,Main city customer sister strategy century. Green night treatment ability least me.,
78,1,Robert,Smith,100.24,2022-05-26 09:45:20,,"1,7,9"
77,1,Robert,Smith,101.88,2022-05-26 04:02:08,,
76,1,Robert,Smith,95.9,2022-05-25 15:13:00,Have spring eat season while. Because carry media will us.,
75,1,Robert,Smith,98.68,2022-05-25 11:55:24,,4
74,1,Robert,Smith,100.11,2022-05-24 15:20:08,,
73,1,Robert,Smith,95.64,2022-05-24 05:40:22,Then piece probably can Mrs. Paper tax account hot that throw across line.,
72,1,Robert,Smith,95.3,2022-05-23 11:30:23,Bad there them read present western kid. Relationship involve create community Mrs. Let personal manager mind fire station near. Owner design new understand.,
71,1,Robert,Smith,99.73,2022-05-23 08:51:23,,"3,9,10"
70,1,Robert,Smith,100.03,2022-05-22 15:25:50,About heart growth beyond laugh because visit style.,"1,3,4,5,6"
69,1,Robert,Smith,95.49,2022-05-21 11:53:47,Support around first significant realize. If opportunity base.,
68,1,Robert,Smith,96.85,2022-05-20 20:13:24,Door major age choice nothing management. Wide activity skill become. Not author administration fine whatever here have. Team officer pull major no feel Mr.,
67,1,Robert,Smith,98.12,2022-05-20 16:56:28,,
66,1,Robert,Smith,96.92,2022-05-20 13:25:36,,
65,1,Robert,Smith,97.79,2022-05-20 09:04:57,Set enjoy happen industry note. Direction character operation hit century compare while. Morning stand large him lose information. Production away reach place building those. Game whose son other.,"5,10"
64,1,Robert,Smith,101.3,2022-05-20 06:22:57,,
63,1,Robert,Smith,95.74,2022-05-19 10:45:38,,
62,1,Robert,Smith,97.19,2022-05-19 02:43:50,,
61,1,Robert,Smith,99.01,2022-05-18 15:59:57,Hospital see prove food. Research road bag. Sense remain suddenly various mother natural nearly cost. Marriage teacher home somebody social hear environmental.,

1 id child_id child_first_name child_last_name temperature time notes tags
2 83 1 Robert Smith 100.2 97.81 2020-02-17 09:31:49 2022-05-28 10:50:06
3 82 1 Robert Smith 99.62 98.67 2020-02-17 04:11:09 2022-05-28 03:09:33
4 81 1 Robert Smith 101.45 95.29 2020-02-17 00:14:09 2022-05-26 22:34:27
5 80 1 Robert Smith 97.41 99.53 2020-02-16 14:42:52 2022-05-26 18:03:27
6 79 1 Robert Smith 99.53 96.72 2020-02-16 11:28:41 2022-05-26 14:32:36 Main city customer sister strategy century. Green night treatment ability least me.
7 78 1 Robert Smith 98.92 100.24 2020-02-16 07:38:01 2022-05-26 09:45:20 1,7,9
8 77 1 Robert Smith 97.69 101.88 2020-02-15 22:53:01 2022-05-26 04:02:08
9 76 1 Robert Smith 98.37 95.9 2020-02-15 17:37:21 2022-05-25 15:13:00 Have spring eat season while. Because carry media will us.
10 75 1 Robert Smith 101.73 98.68 2020-02-15 07:51:45 2022-05-25 11:55:24 4
11 74 1 Robert Smith 98.31 100.11 2020-02-15 03:06:24 2022-05-24 15:20:08
12 73 1 Robert Smith 95.31 95.64 2020-02-14 12:12:28 2022-05-24 05:40:22 Then piece probably can Mrs. Paper tax account hot that throw across line.
13 72 1 Robert Smith 99.5 95.3 2020-02-14 07:41:40 2022-05-23 11:30:23 Bad there them read present western kid. Relationship involve create community Mrs. Let personal manager mind fire station near. Owner design new understand.
14 71 1 Robert Smith 99.9 99.73 2020-02-13 18:05:46 2022-05-23 08:51:23 3,9,10
15 70 1 Robert Smith 98.33 100.03 2020-02-13 14:15:54 2022-05-22 15:25:50 About heart growth beyond laugh because visit style. 1,3,4,5,6
16 69 1 Robert Smith 98.78 95.49 2020-02-13 09:39:03 2022-05-21 11:53:47 Support around first significant realize. If opportunity base.
17 68 1 Robert Smith 98.51 96.85 2020-02-12 18:17:05 2022-05-20 20:13:24 Door major age choice nothing management. Wide activity skill become. Not author administration fine whatever here have. Team officer pull major no feel Mr.
18 67 1 Robert Smith 100.76 98.12 2020-02-12 05:54:01 2022-05-20 16:56:28
19 66 1 Robert Smith 98.96 96.92 2020-02-11 21:00:14 2022-05-20 13:25:36
20 65 1 Robert Smith 95.15 97.79 2020-02-11 17:33:04 2022-05-20 09:04:57 Set enjoy happen industry note. Direction character operation hit century compare while. Morning stand large him lose information. Production away reach place building those. Game whose son other. 5,10
21 64 1 Robert Smith 95.89 101.3 2020-02-11 14:51:04 2022-05-20 06:22:57
22 63 1 Robert Smith 98.57 95.74 2020-02-11 08:30:34 2022-05-19 10:45:38
23 62 1 Robert Smith 99.16 97.19 2020-02-11 06:35:34 2022-05-19 02:43:50
24 61 1 Robert Smith 98.37 99.01 2020-02-10 10:25:06 2022-05-18 15:59:57 Hospital see prove food. Research road bag. Sense remain suddenly various mother natural nearly cost. Marriage teacher home somebody social hear environmental.

View File

@ -44,6 +44,12 @@ class ImportTestCase(TestCase):
def test_child(self):
self.import_data(models.Child, 2)
def test_child_invalid(self):
dataset = self.get_dataset("diaperchange-invalid-child")
resource = admin.DiaperChangeImportExportResource()
result = resource.import_data(dataset, dry_run=False)
self.assertTrue(result.has_validation_errors())
def test_diaperchange(self):
self.import_data(models.DiaperChange, 75)
@ -68,6 +74,20 @@ class ImportTestCase(TestCase):
def test_tag(self):
self.import_data(models.Tag, 10)
def test_tagged(self):
self.import_data(models.Tag, 10)
self.import_data(models.Temperature, 23)
tests = [
(65, ["ten", "method"]),
(70, ["our", "you", "everybody", "ten", "military"]),
(71, ["you", "treatment", "method"]),
(75, ["everybody"]),
(78, ["our", "treatment", "surface"]),
]
for pk, tags in tests:
entry = models.Temperature.objects.get(pk=pk)
self.assertQuerysetEqual(entry.tags.names(), tags, ordered=False)
def test_temperature(self):
self.import_data(models.Temperature, 23)
@ -76,9 +96,3 @@ class ImportTestCase(TestCase):
def test_weight(self):
self.import_data(models.Weight, 5)
def test_invalid_child(self):
dataset = self.get_dataset("diaperchange-invalid-child")
resource = admin.DiaperChangeImportExportResource()
result = resource.import_data(dataset, dry_run=False)
self.assertTrue(result.has_validation_errors())