Skip to content

Commit

Permalink
force deterministic creation date on cathy
Browse files Browse the repository at this point in the history
  • Loading branch information
nicpottier committed Feb 17, 2020
1 parent b5e2fb4 commit cf1b01a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
3 changes: 3 additions & 0 deletions web/contact/contact_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,9 @@ func TestApplyActions(t *testing.T) {
dates.SetNowSource(dates.NewSequentialNowSource(time.Date(2018, 7, 6, 12, 30, 0, 123456789, time.UTC)))
defer dates.SetNowSource(dates.DefaultNowSource)

// to be deterministic, update the creation date on cathy
db.MustExec(`UPDATE contacts_contact SET created_on = $1 WHERE id = $2`, dates.Now(), models.CathyID)

// for simpler tests we clear out cathy's fields and groups to start
db.MustExec(`UPDATE contacts_contact SET fields = NULL WHERE id = $1`, models.CathyID)
db.MustExec(`DELETE FROM contacts_contactgroup_contacts WHERE contact_id = $1`, models.CathyID)
Expand Down
34 changes: 17 additions & 17 deletions web/contact/testdata/apply_actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"id": 10000,
"name": "Cathy",
"timezone": "America/Los_Angeles",
"created_on": "2020-02-10T10:57:50.710449-08:00"
"created_on": "2018-07-06T05:30:00.123457-07:00"
},
"events": []
},
Expand Down Expand Up @@ -48,12 +48,12 @@
"id": 10000,
"name": "Kathy",
"timezone": "America/Los_Angeles",
"created_on": "2020-02-10T10:57:50.710449-08:00"
"created_on": "2018-07-06T05:30:00.123457-07:00"
},
"events": [
{
"type": "contact_name_changed",
"created_on": "2018-07-06T12:30:11.123456789Z",
"created_on": "2018-07-06T12:30:12.123456789Z",
"step_uuid": "efcd6cea-84b6-425e-a07b-e063716f96dd",
"name": "Kathy"
}
Expand Down Expand Up @@ -87,12 +87,12 @@
"uuid": "6393abc0-283d-4c9b-a1b3-641a035c34bf",
"id": 10000,
"timezone": "America/Los_Angeles",
"created_on": "2020-02-10T10:57:50.710449-08:00"
"created_on": "2018-07-06T05:30:00.123457-07:00"
},
"events": [
{
"type": "contact_name_changed",
"created_on": "2018-07-06T12:30:19.123456789Z",
"created_on": "2018-07-06T12:30:20.123456789Z",
"step_uuid": "6ac2c4fe-4a72-4053-9a11-9b9d4f515140",
"name": ""
}
Expand Down Expand Up @@ -130,7 +130,7 @@
"uuid": "6393abc0-283d-4c9b-a1b3-641a035c34bf",
"id": 10000,
"timezone": "America/Los_Angeles",
"created_on": "2020-02-10T10:57:50.710449-08:00",
"created_on": "2018-07-06T05:30:00.123457-07:00",
"fields": {
"age": {
"text": "24",
Expand All @@ -141,7 +141,7 @@
"events": [
{
"type": "contact_field_changed",
"created_on": "2018-07-06T12:30:28.123456789Z",
"created_on": "2018-07-06T12:30:29.123456789Z",
"step_uuid": "0a30f257-f811-4130-a78a-c04586c1e3c9",
"field": {
"key": "age",
Expand Down Expand Up @@ -186,12 +186,12 @@
"uuid": "6393abc0-283d-4c9b-a1b3-641a035c34bf",
"id": 10000,
"timezone": "America/Los_Angeles",
"created_on": "2020-02-10T10:57:50.710449-08:00"
"created_on": "2018-07-06T05:30:00.123457-07:00"
},
"events": [
{
"type": "contact_field_changed",
"created_on": "2018-07-06T12:30:36.123456789Z",
"created_on": "2018-07-06T12:30:37.123456789Z",
"step_uuid": "5f832708-1430-4867-b5d0-6711b238001c",
"field": {
"key": "age",
Expand Down Expand Up @@ -234,7 +234,7 @@
"uuid": "6393abc0-283d-4c9b-a1b3-641a035c34bf",
"id": 10000,
"timezone": "America/Los_Angeles",
"created_on": "2020-02-10T10:57:50.710449-08:00",
"created_on": "2018-07-06T05:30:00.123457-07:00",
"groups": [
{
"uuid": "c153e265-f7c9-4539-9dbc-9b358714b638",
Expand All @@ -245,7 +245,7 @@
"events": [
{
"type": "contact_groups_changed",
"created_on": "2018-07-06T12:30:44.123456789Z",
"created_on": "2018-07-06T12:30:45.123456789Z",
"step_uuid": "fdb474aa-fe8a-4d3e-8515-dd4650cf5117",
"groups_added": [
{
Expand Down Expand Up @@ -289,12 +289,12 @@
"uuid": "6393abc0-283d-4c9b-a1b3-641a035c34bf",
"id": 10000,
"timezone": "America/Los_Angeles",
"created_on": "2020-02-10T10:57:50.710449-08:00"
"created_on": "2018-07-06T05:30:00.123457-07:00"
},
"events": [
{
"type": "contact_groups_changed",
"created_on": "2018-07-06T12:30:52.123456789Z",
"created_on": "2018-07-06T12:30:53.123456789Z",
"step_uuid": "190e3236-23a8-48d1-aae1-769f40a26631",
"groups_removed": [
{
Expand Down Expand Up @@ -334,12 +334,12 @@
"id": 10000,
"language": "fra",
"timezone": "America/Los_Angeles",
"created_on": "2020-02-10T10:57:50.710449-08:00"
"created_on": "2018-07-06T05:30:00.123457-07:00"
},
"events": [
{
"type": "contact_language_changed",
"created_on": "2018-07-06T12:31:00.123456789Z",
"created_on": "2018-07-06T12:31:01.123456789Z",
"step_uuid": "a8665c42-341d-4a4a-9aea-595ab1895f96",
"language": "fra"
}
Expand Down Expand Up @@ -375,15 +375,15 @@
"id": 10000,
"language": "fra",
"timezone": "America/Los_Angeles",
"created_on": "2020-02-10T10:57:50.710449-08:00",
"created_on": "2018-07-06T05:30:00.123457-07:00",
"urns": [
"tel:0788555111"
]
},
"events": [
{
"type": "contact_urns_changed",
"created_on": "2018-07-06T12:31:08.123456789Z",
"created_on": "2018-07-06T12:31:09.123456789Z",
"step_uuid": "60ab6284-71a4-4083-8383-661801bb0bfd",
"urns": [
"tel:0788555111"
Expand Down

0 comments on commit cf1b01a

Please sign in to comment.